Solution: Maze Model

Here’s one possible solution to the Maze model. Yours will probably be different, and might be just as good. That’s the artistry of software engineering: some solutions will be faster, others use less memory, while others will be easier for other people to understand. Optimising and balancing these factors is fun!

The solution notebook can be downloaded from:

https://anaconda.org/ucl-rits/module10-mazesolution/notebook

house = {
    'living' : {
        'exits': {
            'north' : 'kitchen',
            'outside' : 'garden',
            'upstairs' : 'bedroom'
        },
        'people' : ['James'],
        'capacity' : 2
    },
    'kitchen' : {
        'exits': {
            'south' : 'living'
        },
        'people' : [],
        'capacity' : 1
    },
    'garden' : {
        'exits': {
            'inside' : 'living'
        },
        'people' : ['Sue'],
        'capacity' : 3
    },
    'bedroom' : {
        'exits': {
            'downstairs' : 'living',
            'jump' : 'garden'
        },
        'people' : [],
        'capacity' : 1
    }
}

Some important points: