Spaces:
Paused
Paused
Download init_db.py from ILLERRAPS/Multiplayer: direct link, hf CLI and curl.
- Browser
- Download file 874 Bytes
-
https://huggingface.co/spaces/ILLERRAPS/Multiplayer/resolve/main/init_db.py
- Command line
-
hf download hf://spaces/ILLERRAPS/Multiplayer/init_db.py
-
curl -L -o init_db.py https://huggingface.co/spaces/ILLERRAPS/Multiplayer/resolve/main/init_db.py
874 Bytes
| import sqlite3 | |
| def init_db(): | |
| conn = sqlite3.connect('game.db') | |
| cursor = conn.cursor() | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS players ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| username TEXT UNIQUE, | |
| location TEXT, | |
| inventory TEXT | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS game_world ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| location TEXT UNIQUE, | |
| description TEXT, | |
| items TEXT | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS interactions ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| player_id INTEGER, | |
| action TEXT, | |
| result TEXT, | |
| timestamp DATETIME DEFAULT CURRENT_TIMESTAMP | |
| ) | |
| ''') | |
| conn.commit() | |
| conn.close() | |
| init_db() | |