LudoGame

Martin Jaffer
Gayas Chowdhury
December 6, 2014

Overview

An interactive Ludo boardgame which automatically saves history, and can load an earlier time if desired.

Screenshot

Concepts Demonstrated

  • Dotted-tail & Apply are used in bulk-insert to allow multiple insertions into the database with one call.
  • Recursion is used in data-to-player to create a list of (tag . data) in order determined at run-time and of unknown length.
  • Data Abstraction is used in objects and in other places.
  • For-each is in both the object system and the database interface.
  • Map is used for many transformations prepping data for SQL.
  • Filter is used in objects to find the correct block and token for each player.
  • Objects and inheritance are used to implement the bulk of the project. You can't trace any code without walking into one.
  • Let* in player(add-playing-token)
  • #:break in player to break the loop
  • Higher order functions.

External Technology and Libraries

  • racket/include to allow us to combine files
  • db to interface with a command-line MySQL database
  • 2htdp/universe for connecting objects to put the board together on screen from components.
  • 2htdp/image for graphics

Favorite Lines of Code

Martin Jaffer

(define (data-to-player data format)
  (if (null? format) '()
   (cons
    (cons (car format) (apply(cdr(car format))(list (car data))) )
    (data-to-player (cdr data) (cdr format)))))

This is an older more complex version of a function for taking a data and a format, and assembling them for easier transport back to the game engine. The format is a (list (cons tag1 conversion1) (cons tag2 conversion2)...) The data is given the tag, and applied the corresponding function such as string->symbol. Output would be a (list (cons tag1 fixed-data1) (cons tag2 fixed-data2)...)

(define (make-attrib-order lst)
  (string-append* (cdr (append* (map (lambda (x) (list ", " x))
                                     (map (lambda (n) (symbol->string (car n)))lst))))))

This allows the items and order of items in insertions and retrievels from the database to be completely arbitrary as long as the items are tagged. (list (cons tag data))

  • Gayas Chowdhury:
((eq? message 'roll-dice) 
             (lambda (self value) 
               (let ((draw (ask self 'draw-dice)))
                       (if (= draw 6)
                           (ask self 'roll-dice (+ draw value))
                           (remainder (+ draw value) 18)))))

This rolls dice up to 3 times without having to ask it multiple times.

(define (place-and-turn token dial rad)
    (rotate rad
            (overlay/align "center" "top"
                           (draw-token token)
                           dial)))

(define (draw-tokens tokens)
  (if (null? tokens)
      (circle (quotient (* 6 block-size) 2) "solid" "white")
      (place-and-turn (car tokens) (draw-tokens (cdr tokens)) 20)))

This draws a circle of circular tokens.

Technology Used Block Diagram

Create a simple block diagram of your software system that illustrates the major technical components and how they interact. Indicate which partner did which part of the work by putting an individual's initials inside the component(s) for which that person was primarily responsible. E.g.:

Additional Remarks

While not all of the extendibility and moddability goals were reached, and much had to be scaled back, the result looks decent.

The database interface will accept items in any order because it uses tagged input. It creates form from context.

The difference in programming approaches has been a learning experience.