Project 08: Mouse Maze Navigation

Verified

Added on  2019/09/16

|2
|571
|280
Project
AI Summary
This project requires students to develop a C++ program that navigates a mouse through a maze, collecting cheese and finding the exit. The program utilizes a provided library and DLL for graphics and user interface. Students are tasked with implementing the `mouse_move()` function to create a decision-making strategy for the mouse, using helper functions to move and look around the maze. The project emphasizes functionality, code appearance, and comments. Students must submit their code and demonstrate the program to their instructor.
Document Page
CPSC 231 Project 08 Group ________________
________________
________________
Using code already provided, write functions that will move a mouse around a maze in
search of the exit, eating cheese along the way. The compiled program will look as
displayed below.
Download the following files and create a
workspace using them:
https://www.msu.edu/~bowmanm/231/
Project08.zip
Project08.sln, Project08.vcxproj, Project08.vcxproj.filters
Project08.cpp
Maze Library.lib, Images.dll
Maze 01.txt, Maze 02.txt, Maze 03.txt
This program is a Windows executable, not
a command-line program. The graphics and
user interface have been designed for you
and are included in Maze Library.lib and
Images.dll. You will need to compile the
program using the Microsoft Visual Studio.
The zip file also includes three text files that
contain maze maps to test your program.
The mouse maze is stored as a two-dimensional array of cells. A cell has the following
values:
CELL_OPEN Open space – the mouse can move here.
CELL_WALL Wall – the mouse can’t move here.
CELL_CHEESE Open space with cheese. After moving the mouse here, the cell
changes to CELL_OPEN.
CELL_EXIT The exit of the maze
You are provided two functions, which are called by the program when it runs:
void mouse_init(int x,int y) This is called when a maze map is loaded.
void mouse_move() This is called each tick of the internal timer.
When you select a maze file, the program calls mouse_init(). You are provided
access to this function in case you need to initialize variables that are global to your
Project08.cpp file.
When you start the mouse (select a speed from the Run drop-down), a timer begins.
Every tick of the timer, the mouse_move() function is called. The sample provided only
attempts to move the mouse at random. You will develop this function to make your
mouse “smarter” as it searches for the exit.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Several helper functions are provided:
void mouse_look(cell map[3][3])
This function copies the cells surrounding the mouse from the internal map and
places them in a 3x3 array. Your mouse is at position 1,1. Use this mini-map to
determine which direction the mouse should move.
bool mouse_north()
bool mouse_south()
bool mouse_east()
bool mouse_west()
Each of these functions attempt to move in the direction indicated. If you attempt
to move into a wall cell, the function will return false. The main program will
only allow one move of the mouse each time the mouse_move() function is
called.
Since time is limited, do not worry about perfecting your functions. Try to incorporate a
simple decision making strategy, like don’t back up unless at a dead end, always turn
left, or keep track of your last direction.
What to hand in
Hand in a paper copy of your Project08.cpp file. In addition, email a copy of your
Project08.cpp file to your instructor. Demonstrate your program to the instructor with
multiple runs to show that it works. Your code will be graded on its functionality,
appearance, and comments.
chevron_up_icon
1 out of 2
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]