Module Expr Str Import alias Import alias alias Import alias identifier Import alias Assign NameStore TupleLoad Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str keyword Str Assign NameStore Dict Str Str Str Str Num Dict ListLoad Dict Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str keyword NameLoad FunctionDef arguments args defaults body Expr Str Expr Call AttributeLoad NameLoad attr decorator_list ClassDef bases body FunctionDef arguments args NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num orelse Assign NameStore NameLoad If BoolOpAnd UnaryOpNot Call AttributeLoad NameLoad attr Str UnaryOpNot Call AttributeLoad NameLoad attr Str body Assign NameStore Str orelse Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If BoolOpOr CompareEq NameLoad NameLoad CompareGt AttributeLoad NameLoad attr Num body Raise Call AttributeLoad NameLoad attr Str Return Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Str NameLoad decorator_list decorator_list ClassDef bases body FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Raise Call AttributeLoad NameLoad attr Str decorator_list decorator_list ClassDef bases body FunctionDef arguments args NameParam defaults body Expr Str Expr Call NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list decorator_list ClassDef bases body FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr attr If CompareIn NameLoad ListLoad Str Str Str body Assign NameStore Call NameLoad BinOpAdd Str NameLoad orelse Assign NameStore AttributeLoad NameLoad attr If CompareNotEq NameLoad AttributeLoad NameLoad attr body AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list decorator_list ClassDef bases body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr attr If UnaryOpNot NameLoad body Assign NameStore Num If CompareIn NameLoad ListLoad Str Str body Raise Call AttributeLoad NameLoad attr Str orelse If CompareIn NameLoad ListLoad Str body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list decorator_list ClassDef bases body FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str If CompareIn NameLoad ListLoad Str Str Str body Assign NameStore BinOpMult Call NameLoad BinOpAdd Str NameLoad AttributeLoad NameLoad attr orelse Assign NameStore AttributeLoad NameLoad attr If BoolOpAnd CompareNotEq Call AttributeLoad NameLoad attr Str UnaryOpNot Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad orelse Assign NameStore NameLoad If BoolOpAnd NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list decorator_list If CompareEq NameLoad Str body Expr Str If AttributeLoad AttributeLoad NameLoad attr attr body Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr
N/A N/A 
    webinterface.py
    
    Andy Freeland and Dan Levy
    5 June 2010
    
    Web interface to the twenty questions game. Each page/url is represented by
    a class. Uses the web.py library from http://webpy.org. Stores user data in
    a sesssion. HTML pages are stored in the templates directory, while static
    files such as CSS and fonts are stored in the static directory.
 N/A web N/A config model N/A twentyquestions game N/A admin N/A urls N/A / index /begin begin /answer/(\d+) answer /guess guess /guess/(\d+) guess /learn learn /restart restart /admin N/A admin app N/A app N/A N/A web application urls N/A globals N/A render N/A N/A N/A web template render templates base base N/A session_vars N/A count asked_questions initial_questions objects_values 1 N/A N/A N/A N/A session N/A N/A N/A web session Session app N/A N/A N/A web session DiskStore sessions initializer session_vars reset_game N/A N/A N/A N/A N/A Kills the session. N/A N/A N/A session kill N/A index N/A N/A GET N/A N/A self N/A N/A N/A Shows the index page and asks the questions. N/A N/A config DISPLAY_CANDIDATES N/A N/A nearby_objects_values N/A N/A game get_nearby_objects_values N/A session objects_values how_many 10 N/A N/A nearby_objects_values None N/A N/A N/A N/A N/A session get asked_questions N/A N/A N/A session get initial_questions N/A N/A question begin N/A N/A question N/A N/A game choose_question N/A session initial_questions N/A session objects_values N/A session asked_questions N/A N/A N/A question None N/A N/A session count 20 N/A N/A N/A N/A web seeother /guess N/A N/A N/A render index question N/A N/A session get count nearby_objects_values N/A N/A begin N/A N/A POST N/A N/A self N/A N/A N/A Initializes the session and returns to the index. N/A N/A session initial_questions N/A N/A game load_initial_questions N/A N/A session objects_values N/A N/A game load_objects_values N/A N/A N/A web seeother / N/A N/A restart N/A N/A POST N/A N/A self N/A N/A N/A Restarts the game. N/A N/A reset_game N/A N/A N/A web seeother / N/A N/A answer N/A N/A POST N/A N/A self question_id N/A N/A N/A Updates the local knowledgebase with the answer given to the question_id. N/A question_id N/A int question_id N/A a N/A N/A N/A web input answer N/A N/A a N/A yes no unsure N/A N/A answer N/A eval N/A game. a N/A N/A answer N/A game unsure N/A N/A answer N/A game unsure N/A N/A N/A session count 1 N/A N/A N/A game update_local_knowledgebase N/A session objects_values N/A session asked_questions question_id answer N/A N/A N/A web seeother / N/A N/A guess N/A N/A GET N/A N/A self chosen_id N/A None N/A N/A Displays the computer's guess of who the user is thinking of. N/A chosen N/A N/A game guess N/A session objects_values N/A N/A N/A render guess chosen N/A POST N/A N/A self chosen_id N/A None N/A N/A Learns whether the guess was correct or not. If 'yes', learn and restart.
           If 'no', go to 'learn' to learn a new character. N/A a N/A N/A N/A web input answer N/A N/A chosen_id N/A N/A chosen_id 1 N/A N/A a N/A no teach me N/A N/A N/A N/A web seeother /learn N/A N/A N/A a N/A yes N/A N/A N/A N/A game learn N/A session asked_questions N/A int chosen_id N/A N/A reset_game N/A N/A N/A web seeother / N/A N/A learn N/A N/A GET N/A N/A self N/A N/A N/A Renders the learn page, allowing the user to select the correct character
           and add a new question. N/A nearby_objects N/A N/A game get_nearby_objects N/A session objects_values how_many 20 N/A N/A N/A render learn nearby_objects N/A POST N/A N/A self N/A N/A N/A Processes the learning form and learns the correct character and new
           question. N/A inputs N/A N/A web input N/A name N/A N/A inputs get name N/A N/A name new N/A N/A name N/A N/A inputs get new_character N/A question N/A N/A inputs get question N/A question N/A N/A new_question_answer N/A N/A inputs get new_question_answer N/A N/A new_question_answer N/A yes no unsure N/A N/A answer N/A N/A eval N/A game. new_question_answer N/A game NEW_QUESTION_SCALE N/A N/A answer N/A game unsure N/A N/A N/A N/A N/A question strip N/A N/A N/A model get_question_by_text N/A N/A question strip N/A N/A new_question_id N/A N/A model add_question question N/A N/A new_question N/A N/A model get_question_by_text N/A N/A question strip N/A new_question N/A N/A new_question_id N/A new_question id N/A N/A new_question_id None N/A name N/A N/A new_object_id N/A N/A game learn_character N/A session asked_questions name N/A N/A new_object_id None N/A N/A new_question_id new_object_id N/A N/A N/A N/A model update_data new_object_id new_question_id answer N/A N/A reset_game N/A N/A N/A web seeother / N/A N/A N/A N/A __name__ __main__ N/A N/A Runs the app. N/A N/A N/A web config debug N/A N/A N/A app internalerror N/A web debugerror N/A N/A N/A app run