D10d3

frame-outline.py

Nov 13th, 2016
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #this is not a part of the program, or even actual code
  2. #it is just an outline to look at the whole program at a glance
  3. #saved as a .py so it'll highlight and read nicely in my editor
  4.  
  5. _______________________GAME.PY________________________
  6. import os
  7. os.system('cls')
  8. import random
  9. import game_engine
  10. import game_data
  11.  
  12. class game_loop(object): #Game loop
  13.     def play(object):
  14.         location = game_data.testroom1() #starting location
  15.         engine = game_engine.engine() #engine classes
  16.         reader = game_engine.reader() #parser classes
  17.         system = game_data.system.settings #engine data
  18.         while True:     #game loop
  19.             engine.describe_room(location,system)          
  20.             #get user input, then break it down into a list of words
  21.             action = raw_input("Command?> ")
  22.             action = reader.break_words(action)
  23.             #now run the input list against a number of word checkers in the parser
  24.             profanity = reader.profanity(action)            #swearing?
  25.             location = reader.exit(action,location,system)  #moving to another room?
  26.             look_at = reader.look_at(action,location,system) #looking at an object?
  27.             recognized = reader.recognized(action)          #returns error message if all words unknown
  28.             system = reader.system(action,system)           #system command?
  29.             if system: #if reader.system receives "restart" it sets system to True
  30.                 restart = game_loop() #creates new game_loop instance
  31.                 restart.play() #starts new game loop
  32.  
  33. start = game_loop() #instantiate game_loop
  34. start.play() #start game loop
  35.  
  36. _____________________GAME_ENGINE.PY_____________________
  37. import game_data
  38. class engine():
  39.     def describe_room(location,system): #print description from room data
  40. class reader():     #parser methods
  41.     def break_words(action):        #breaks 'action' input into a list of words
  42.     def exit(action,location,system):   #checks input to see if it's a move order
  43.     def profanity(action):          #checks for profanity
  44.     def system(action,system):      #checks for system commands
  45.     def look_at(action,location,system): #checks for description query
  46.     def recognized(action):         #is known word? error message if not
  47.  
  48. ______________________GAME_DATA.PY______________________
  49. #       *** Game States     ***
  50. class system():
  51.     brief = True #True = brief description, False = Verbose
  52.     rooms_visited = []
  53.     settings = [brief,rooms_visited]
  54. #       *** Room Classes        ***
  55. class default_room(object):         #parent for room classes
  56. class testroom1(default_room):
  57. class testroom2(default_room):
  58. class testroom3(default_room):
  59.  
  60. #       *** Word Lists      ***
  61. class words(object):
  62.     system_commands = [list]            #load, save, restart, ect...
  63.     inventory_commands = [list]     #get, drop equip, ect...
  64.     nav_commands = [list]               #north, south, ect...
  65.     verbs = [list]                      #open, close, attack, move, ect...
  66.     describers = [list]             #look, examine, ect...
  67.     profanity = [list]                  #shit, damn, fuck, ect...
  68.     current_place_words = [list]    #here, room, place, ect...
  69.     wordlists = [list of list]      #list of all word lists
RAW Paste Data