#include "../Libs/FSM_LIB/AIWrapper.h"
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
Classes | |
class | DrugUser |
Functions | |
int | main () |
DRUG_USER_BEHAVIOR_FSM_ID:
State 0: Waiting - goes to 1 if has drugs AND wants drugs AND no cops, goes to 4 if has drugs AND cops there, goes to 2 if wants drugs AND no drugs
State 1: Taking Drugs - goes to 4 if still has drugs left after using AND cops are there, goes to 0 if no cops OR (cops AND no drugs left)
State 2: Steal for Money - goes to 4 if cops there, goes to 3 if no cops AND stole enough
State 3: Buy Drugs - goes to 4 if have drugs AND cops there, goes to 1 if no cops
State 4: Go to Jail - loses all drugs and ill-gotten money, goes to jail; goes back to this state when released (think of this state as being at the front gate). If at this state after being released from jail, goes to 10
State 10: Back on the Streets - goes to 0 if old friends are found
SURVIVE_JAIL_FSM_ID:
State 5: Sit in Jail - goes to 6 when 1/3 of time served
State 6: Sit in Jail - goes to 7 when 2/3 of time served
State 7: Sit in Jail - goes to 8 when all of time served
State 8: Get out of Jail - goes to 4 (front gate of jail)
State 9: Dead - if killed in jail, this is the final state
Exercise for beginners: KILLED_IN_JAIL is never thrown, so state 9 is never reached. Modify the code so that the user can die.
|
|