From f24f3866b5cc5ccf0eaf32489892e14f6d94f899 Mon Sep 17 00:00:00 2001 From: Jeff Armstrong Date: Sat, 27 Jul 2013 14:33:37 -0400 Subject: database --- src/1.json | 4 ---- src/10.json | 4 ---- src/11.json | 4 ---- src/12.json | 4 ---- src/13.json | 4 ---- src/2.json | 4 ---- src/3.json | 4 ---- src/4.json | 4 ---- src/5.json | 4 ---- src/6.json | 4 ---- src/7.json | 4 ---- src/8.json | 4 ---- src/9.json | 4 ---- src/game.db | Bin 0 -> 9216 bytes src/room.py | 12 +++++++++--- 15 files changed, 9 insertions(+), 55 deletions(-) delete mode 100644 src/1.json delete mode 100644 src/10.json delete mode 100644 src/11.json delete mode 100644 src/12.json delete mode 100644 src/13.json delete mode 100644 src/2.json delete mode 100644 src/3.json delete mode 100644 src/4.json delete mode 100644 src/5.json delete mode 100644 src/6.json delete mode 100644 src/7.json delete mode 100644 src/8.json delete mode 100644 src/9.json create mode 100644 src/game.db (limited to 'src') diff --git a/src/1.json b/src/1.json deleted file mode 100644 index b1663cf..0000000 --- a/src/1.json +++ /dev/null @@ -1,4 +0,0 @@ -{"name":"Great Hall", - "description": "You're standing in the Great Hall. It is very red. It extends to the west.", - "neighbors": {"w":2} - } \ No newline at end of file diff --git a/src/10.json b/src/10.json deleted file mode 100644 index 3c57293..0000000 --- a/src/10.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Grand Ballroom", - "description" : "The Archie M. Griffin Grand Ballroom is an enormous event space that currently sits empty. Dim lights in the ceiling barely illuminate the empty floor. Apparently no events are planned for here today, which seems odd being that it's a Saturday. The exit liest to the west.", - "neighbors" : {"w" : 7} -} \ No newline at end of file diff --git a/src/11.json b/src/11.json deleted file mode 100644 index ca0b46b..0000000 --- a/src/11.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Outside the Round Room", - "description" : "You're standing in the open space just outside the Round Room, which lies to the west. The space opens to the south to overlook the Great Hall. A table can be seen to the north with some smiling people sitting behind it.", - "neighbors" : {"s" : 9, "w" : 12, "n" : 13} -} \ No newline at end of file diff --git a/src/12.json b/src/12.json deleted file mode 100644 index af1e18d..0000000 --- a/src/12.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Round Room", - "description" : "This odd space appears to be a meeting room of sorts, namely because of the presence of a large projector screen to the north. The walls are ringed with two levels of carpeted ledges where one would apparently sit during a presentation. Judging by the large table in the center of the room, the organizers were not fans of this layout. Instead, the room will probably act as an area for refreshments. An exit leads to the east.", - "neighbors" : {"e" : 11} -} \ No newline at end of file diff --git a/src/13.json b/src/13.json deleted file mode 100644 index f1cfb79..0000000 --- a/src/13.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Registration Table", - "description" : "A long table stand before you covered in free paraphenalia for your enjoyment. A volunteer behind the table smiles and says, \"Welcome to PyOhio!\"", - "neighbors" : {"s" : 11} -} diff --git a/src/2.json b/src/2.json deleted file mode 100644 index 260a238..0000000 --- a/src/2.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Great Hall", - "description" : "You're standing in the center of the Ohio Union's Great Hall, which stretches to the east and west. Looking up, you can see the balconies of the two upper floors wrapping around the hall. To the north, the entrances to a meeting room can be seen propped open.", - "neighbors" : {"n" : 8, "e" : 1, "w" : 3} -} \ No newline at end of file diff --git a/src/3.json b/src/3.json deleted file mode 100644 index 6b94da5..0000000 --- a/src/3.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Great Hall", - "description" : "You're at the western end of the Great Hall, which stretches off to the east. A staircase here leads up to the second floor. On an easel next to the stairs is a large sign with the PyOhio logo and an arrow pointing up. To the north and south are restrooms in case you need to stop in. The paths westward are blocked by signs indicating renovations.", - "neighbors" : {"n" : 5, "e" : 2, "up" : 6, "s" : 4} -} \ No newline at end of file diff --git a/src/4.json b/src/4.json deleted file mode 100644 index 2395f51..0000000 --- a/src/4.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Out-of-Service Restroom", - "description" : "The restroom you've walked into has a number of stalls, all of which are blocked with yellow tape reading \"Do Not Enter.\" Hopefully this tape is only indicating some plumbing problems. The exit lies to the north.", - "neighbors" : {"n" : 3} -} \ No newline at end of file diff --git a/src/5.json b/src/5.json deleted file mode 100644 index 17d0f17..0000000 --- a/src/5.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Restroom", - "description" : "This restroom is spacious, featuring 5 bathroom stalls, all of which appear to be occupied. The exit lies to the south", - "neighbors" : {"s" : 3} -} \ No newline at end of file diff --git a/src/6.json b/src/6.json deleted file mode 100644 index 1f1920c..0000000 --- a/src/6.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Stained Glass Lounge", - "description" : "This lounge features a tall, two-story window looking out onto the Ohio State campus to the west. This early in the morning the tables, chairs, and couches are empty. Staircases lead up to the third floor and down to the ground floor. The southern balcony is currently closed off by a janitor's cart, and you can see a uniformed man vacuuming the bright red carpet. A hallway leads off to the north.", - "neighbors" : {"up" : 9, "n" : 7, "down" : 3} -} \ No newline at end of file diff --git a/src/7.json b/src/7.json deleted file mode 100644 index 1942b3c..0000000 --- a/src/7.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Ballroom Hallway", - "description" : "The short hallway opens to the east into a dark ballroom. Doors to the west, labeled \"Senate Chambers\" and \"Traditions Room\" are closed and locked.", - "neighbors" : {"s" : 6, "e" : 10 } -} \ No newline at end of file diff --git a/src/8.json b/src/8.json deleted file mode 100644 index 16fa478..0000000 --- a/src/8.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Great Hall Meeting Room", - "description" : "This large meeting room appears to be in the middle of preparations for some sort of function. There are a number of round tables set up, but there are no chairs around them. The lights in the room are off, and the only light is streaming in from the doors to the south. This room certainly isn't being used for the PyOhio conference.", - "neighbors" : {"s" : 2} -} diff --git a/src/9.json b/src/9.json deleted file mode 100644 index c4d8361..0000000 --- a/src/9.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Third Floor Stairs", - "description" : "You're at the top of the staircases, which lead down to the second floor. From this vantage point, you can see down into the Great Hall. A sign posted to the north features a large PyOhio logo.", - "neighbors" : {"down" : 6, "n" : 11 } -} \ No newline at end of file diff --git a/src/game.db b/src/game.db new file mode 100644 index 0000000..bd0631e Binary files /dev/null and b/src/game.db differ diff --git a/src/room.py b/src/room.py index 0db88ca..1bc3747 100644 --- a/src/room.py +++ b/src/room.py @@ -1,13 +1,19 @@ import json - +import sqlite3 def get_room(id): ret = None - with open(str(id)+".json", "r") as f: - jsontext = f.read() + + con = sqlite3.connect("game.db") + + for row in con.execute("select json from rooms where id=?",(id,)): + + jsontext = row[0] d = json.loads(jsontext) d['id'] = id ret = Room(**d) + break + return ret class Room(): -- cgit v1.2.3