Added tests and fixed a bug in dungeon.py