MazeRunner

Ming Yui Chung
Zorigtbaatar Chuluundorj
December 8, 2014

Overview

This is a maze game which you need to escape without being caught by the monsters.

Screenshot

Concepts Demonstrated

  • Data abstraction: Used to create objects for players and monsters.
  • List: Represented the maze structure and monsters.
  • Map: Used to manipulate the maze and the monsters. Furthermore, it was used to check termination of the game.
  • Symbolic language processing techniques: Compare locations of player and monsters.
  • Recursive Calling: Used during creation the maze.

External Technology and Libraries

Libraries:

  • racket/gui: Create 2D images and user interface
  • math/base: Used the random-integer function to randomize the location of monsters

Favorite Lines of Code

Each partner should identify a favorite line of code, Scheme expression, or entire procedure written by himself / herself in the entire project, and explain what it does. E.g.:

  • Ming Yui Chung:

(define (make-maze x y run-start)

  (let ((adj-max (- max-size 1))
        (rand (random 2)))
    (cond ((and (> x 0) (or (= y adj-max) (= rand 0))) ; Open north wall of a randomly chosen cell
           (let ((open-y (+ run-start (random (+ (- y run-start) 1)))))
             (set-north-wall x open-y maze)
             (make-maze x (+ y 1) (+ y 1))))
          ((< y adj-max) ; Open all cells that go east
           (set-east-wall x y maze)
           (make-maze x (+ y 1) run-start)) 
          (else 
           (if (<= (+ x 1) adj-max)
               (make-maze (+ x 1) 0 0)
               (values))))))

This code creates the maze using the sidewinder algorithm. It goes through a list of cells and randomly opens up the north or east side of each cells.

  • Zorigtbaatar Chuluundorj:
    (define (move message object canvas maze max-maze) (cond ((eq? message 'move-left) (list
                                   (* (- (room-y (find-object-location-room object canvas maze max-maze)) 0.75) (width-of-a-room canvas maze))
                                   (* (+ (room-x (find-object-location-room object canvas maze max-maze)) 0.25) (height-of-a-room canvas maze))))
        ((eq? message 'move-up) (list 
                                 (* (+ (room-y (find-object-location-room object canvas maze max-maze)) 0.25) (width-of-a-room canvas maze))
                                 (* (- (room-x (find-object-location-room object canvas maze max-maze)) 0.75) (height-of-a-room canvas maze))))
        ((eq? message 'move-right) (list
                                    (* (+ (room-y (find-object-location-room object canvas maze max-maze)) 1.25) (width-of-a-room canvas maze))
                                    (* (+ (room-x (find-object-location-room object canvas maze max-maze)) 0.25) (height-of-a-room canvas maze))))
        ((eq? message 'move-down) (list
                                   (* (+ (room-y (find-object-location-room object canvas maze max-maze)) 0.25) (width-of-a-room canvas maze))
                                   (* (+ (room-x (find-object-location-room object canvas maze max-maze)) 1.25) (height-of-a-room canvas maze))))))

This block takes care of movement of objects by using existing functions to convert between data types.

Technology Used Block Diagram

Additional Remarks

None.