COP2500 Assignment 11

Deliverables: To complete this assignment you must perfom three tasks --

  1. Play the games listed on this page.
  2. Answer the questions below by editing this file.
  3. Show your HTML document to your instructor.

Introduction: Math, computer science, and games are all closely related. There is an area of mathematics called game theory. Game theory deals in part with deriving algorithms that give the best chance of winning. Since games can be described in mathematical terms they can be described in computational terms also. And the data structures we've talked of over the last few lectures are of use in describing simple games.

This lab has two games for you to play. The first is a simple labyrinth and the second is the classic Towers of Hanoi puzzle. Play. Enjoy. Then answer the questions at the bottom of this page.

The Labyrinth Game

This is a typical maze with the typical outcomes. You enter. Each room has two doors - one on the left and one on the right. You move through the maze until you find the treasure and become fabulously wealthy or you end up in limbo. Limbo is a nondescript room that you cannot escape from. Note: There may be more than one limbo room.



YOU MAY MOVE LEFT OR RIGHT.


The Towers of Hanoi


The following web page has the Towers of Hanoi game coded in JavaScript. Towers of Hanoi

Questions:


1.) Based on class discussion and the behavior of the code, what data structure was used to represent the labyrinth?

2.) Based on class discussion and the behavior of the code, what data structure is most suited for use in the Towers of Hanoi problem?

3.) Based on class discussion and behavior of the code, what standard function corresponds to removing a disk from one of the Towers of Hanoi? What standard function corresponds to placing a disk on a Tower of Hanoi?

4.) What is the correct sequence of left and right turns to escape the labyrinth?

5.) Based on the number of left and right turns you must make to escape the labyirnth, how many rooms does the labyrinth have?