You are an acorn, heir to the Honourable Furious Forest Throne. Your beauty shines like no other, reflecting the colorful solar rays into the eyes of all spectators. But instead of your usual coat of beautiful acorn shell, you find yourself covered in ash. Not only that, but you've fallen great depths from the heights of the towering trees of the Honourable Furious Forest that once cared for you.
You shed a tear of loss. The horrid memories of the Fire Nation's invasion flash before you as you relive the moments your hometown, the Honourable Furious Forest, was burnt to ashes. Your friends, the koalas and kangaroos, your family, the Honourable Furious Forest members, all burnt to a crisp.
Mustering up your motivation for revenge, you, the acorn, heir to the Honourable Furious Forest Throne, stumble forward and find yourself in a maze. You observe walls of fire, helicopter search lights and teleporting pads within.
You cry out and slam your little acorn fist on the greyed Honourable Furious Forest floor of dried up leaves. You swear upon your Father's name, Lord Scarlet Oak of the Honourable Furious Forest, that you will conquer this maze and restore the Honourable Furious Forest back to its former glory of rainbow and sunshine.
Check the Ed pinned posts for a video demonstrating this assignment in action!
This document may receive updates. Please keep an eye on Ed announcements for any amendments.
Description
In this assignment there will be three parts:
A game component. You must be able to play the game yourself.
The game will be a 2D maze with the objective of moving from start to end.
A solver component.
It should play the game as many times as it needs to generate a successful path. More on this in the Solver section of this specification.
A report.
3 questions on testing and a short analysis on the solver algorithms involved.
Example screenshot with emojis:
Legend:
🌰: The acorn (start)!
🏴: Ending/Goal cell
➖: Wall cell
💧: Water bucket cell
🔥: Fire cell
1/2: Teleport cell
Unfortunately, as Ed doesn't support emojis, your game will have to be in ASCII letters as shown in the sample outputs below!
Cells
Cell character |
Meaning |
A |
Player cell (stands for Acorn) |
' ' |
Air cell (space bar) |
X |
Starting cell |
Y |
Ending/Goal cell |
* |
Wall cells |
1, 2, 3, 4, 5, 6, 7, 8, 9 |
Teleport cells. These numbers will come in pairs. On stepping onto the cell, you enter the cell '1', you teleport to the other '1'. Values greater than 9 will not be given. Note: 0 is not a valid teleport pad! |
W |
A water bucket cell. On stepping onto the cell, the player gains a water bucket. |
F |
A fire obstacle that you cannot pass unless you have a water bucket. |
Configuration
There will be one txt file which contains an ASCII representation of the maze. The maze may have more than one viable solution. The symbols correspond to the cell characters outlined above. All letters shall be in upper case.
Example configuration file:
Commands
Command |
Meaning |
w |
Move up |
a |
Move left |
s |
Move down |
d |
Move right |
e |
Wait a turn |
q |
Quit the game |
If the user enters an invalid move, print Please enter a valid move (w, a, s, d, e, q). . These commands are case-insensitive!
See the sample outputs below for usage!
Implementation details
Your program will be written in Python 3. The only in-built module methods and attributes you are allowed to use are:
<--- (More on this later) You may not import any other modules.
To help you, a scaffold of a suggested implementation structure is provided. Some test cases require certain features of your code and cannot be modified.
Things you CANNOT modify (these are tested):
File |
Function/Attribute |
Why it must not be modified |
game_parser.py |
parse() |
parse(lines) must take in a list of strings and must return a list of lists of cells. This will be tested. |
grid.py |
grid_to_string() |
grid_to_string(grid, player) must take in a list of list of cells and a player and must return a single string representing the grid & water buckets. This will be tested |
cells.py |
display |
The display attribute will be used to test your grid_to_string() function. |
player.py |
display |
Same as above. |
player.py |
num_water_buckets |
The num_water_buckets attribute will be used to test your grid_to_string() function. |
You may modify any other files to your liking. The rest of the scaffold is to help you with some basic structure! You may, of course, import your own modules...! You are also encouraged to write helper functions appropriately.
Note: No file other than
and
should print to the screen! Only
should
print to the screen while playing the game. This is good programming practice, so get used to it early! If needed, you may use it sparingly to debug your program!
game.py
It is recommended you write your game engine here. By writing a class, you can easily run
and delete game instances for your solver. The game engine should hold all the relevant data regarding the game's state. This includes the moves made, the player's position, the cells, etc.
cells.py
It is recommended that you write your cells here. All cells must have a attribute. We
recommend your cells also have a
method. The
method should take in a
object (defined above) and make modifications to the game depending on the cell.
If you are a strong programmer and know how to use inheritance, you may use it. Using inheritance will not advantage you much however, and the assignment is completely doable without it! We will not teach it in this course, so it is up to you if you want to use it!
Notable cells:
Cell
If a user steps onto a message
cell, the user should be pushed back to their original cell and the should be returned. The game should not record
illegal user moves onto walls or out of bounds!
Cell
If a user steps onto a
cell, it should increment the player's water bucket count and return
the message Thank the Honourable Furious Forest, you've found a bucket of water! . It
should then behave like an
Cell
If a user steps onto a
block.
cell, two things can happen:
If the user has at least one water bucket, it should return the message
acorn arms, you throw a water bucket at the fire. You acorn roll your way
and reduce the player's water bucket count by one.
The fire block should then behave like an block.
If the user does not have a water bucket, it should return the message
and end the game.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of