Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ If we want to expand the API for connections, we can always add more symbols
for parsing. One I was thinking about is `\->`, which would denote an
"ending" connection (to signal destroying the path to reach the current action)

# Running Games

1. Enter the repository: `cd Classic-RPG`

2. Run a game: `python -m games.game-1`
2 changes: 1 addition & 1 deletion crpg/builtin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations #needed for Node type hints
from __future__ import annotations # needed for Node type hints
# Base player classes

class Player:
Expand Down
4 changes: 2 additions & 2 deletions crpg/crpg.py → crpg/engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from setup import start
from builtin import Connection, Node, Location, Player
from .setup import start
from .builtin import Connection, Node, Location, Player

# the base crpg game

Expand Down
5 changes: 3 additions & 2 deletions crpg/parser/parser_v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from crpg import Game
from typing import Callable # for connection function type hints
import re
from builtin import Connection, BreakingConnection, Node, Location

from crpg.engine import Game
from crpg.builtin import Connection, BreakingConnection, Node, Location


node_types = {
Expand Down
5 changes: 3 additions & 2 deletions crpg/parser/parser_v2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from crpg import Game
from typing import Callable, Any # for connection function type hints
import re
from builtin import Connection, BreakingConnection, Node, Location

from crpg.engine import Game
from crpg.builtin import Connection, BreakingConnection, Node, Location


# connection function mapping
Expand Down
7 changes: 2 additions & 5 deletions games/game-1.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import sys
sys.path.insert(0, "../crpg")

from crpg import Game
from builtin import Location, Node
from crpg.engine import Game
from crpg.builtin import Location, Node

starting_location = Location("castle")
starting_location.add_attr(
Expand Down
9 changes: 5 additions & 4 deletions games/game-2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
sys.path.insert(0, "../crpg")
import os

import parser
from crpg.parser import v1 as v1_parser

game = parser.v1("game-2-layout.dl")

filepath = os.path.abspath("games/game-2-layout.dl")
game = v1_parser(filepath)
game.start()
9 changes: 5 additions & 4 deletions games/game-3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
sys.path.insert(0, "../crpg")
import os

import parser
from crpg.parser import v2 as v2_parser

game = parser.v2("game-3.dl")

filepath = os.path.abspath("games/game-2-layout.dl")
game = v2_parser(filepath)
game.start()