コード例 #1
0
ファイル: test.py プロジェクト: xoliver/fddojo1
from constants import MOVES
from map import Labyrinth


if __name__ == '__main__':
    lab = Labyrinth(10, 10)
    print 'You are somewhere...\n'

    while True:
        print '>', 
        line = raw_input().lower()
        try:
            cmd, direction = line.split(' ')
        except:
            print 'NO IDEA WHAT YOU SAID'
            continue

        if cmd != 'go' and direction not in MOVES:
            print 'CANNOT UNDERSTAND COMMAND OR DIRECTION'

        room = lab.move_player(direction)

        print lab.text_map()
コード例 #2
0
ファイル: map_demo.py プロジェクト: xoliver/fddojo1
from map import Labyrinth

test_lab = Labyrinth(10,20)
print test_lab.text_map()

print test_lab[(0,0)].make_description()
print test_lab[(1,1)].make_description()

print test_lab.player_location
print test_lab.monster_location
room = test_lab.get_current_player_room()
print room.make_description()

test_lab.move_player("north")
print test_lab.player_location