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 @@ -40,6 +40,9 @@ Have a look at [this great blog post](http://gameprogrammingpatterns.com/state.h
After cloning the repository, run the following commands to build the project:

```
# create the state machine files
./bin/mr_fsm_gen.py -i examples/simple_fsm.yml -o examples/

mkdir build
cd build
cmake ..
Expand Down
6 changes: 3 additions & 3 deletions bin/mr_fsm_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def terminate(self):
class Transition(object):

def __init__(self, transition_yml):
self.input = transition_yml.keys()[0]
self.next_state = transition_yml.values()[0]
self.input = list(transition_yml.keys())[0]
self.next_state = list(transition_yml.values())[0]

def __str__(self):
return "Transition={{ input={} next_state='{}' }}"\
Expand Down Expand Up @@ -154,7 +154,7 @@ def __init__(self, infile, outdir, default_implementations):

def _parse_input_file(self):
with open(self.input_file, 'r') as stream:
yml = yaml.load(stream)
yml = yaml.safe_load(stream)
self._validate_fsm_yml(yml)
name = yml["name"]
states = []
Expand Down