December 8, 2014
Our project was to re-create a mobile app called 'Flappy Bird'. The user plays as a bird that flies through a world while avoiding oncoming pipes. The user's performance will gain them points based on how long they survive. We also developed an AI that could learn how to play through the game.
- Object Orientation was used to hold and handle all information for items in the environment.
- Mapping and list searching was used in the reinforcement learning.
External Technology and Libraries
For our project the following libraries were used
- 2hdtp/image was used to render images to the world
- lang/posn was used to handle positioning of images and items in the world
- 2hdtp/universe was used to create the world itself and handled user input. The clock ticks from the world were used to handle physics.
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.:
- Mike Begonis:
[(eq? message 'accelerate) (lambda (self) (if (ask self 'jumping?) (cond [(< velocity min-velocity) (set! JUMPING #f) (ask self 'set-velocity min-velocity) velocity] [else (ask self 'inc-velocity (* -1 jump-accel))]) (cond [(> velocity max-velocity) (ask self 'set-velocity max-velocity)] [else (ask self 'inc-velocity fall-accel)])))]
This code handles the acceleration of the bird during every tick of the world's internal clock. During every tick the bird will accelerate towards the ground, unless in the case that the bird is jumping, where the bird will then abruptly change direction and temporarily accelerate upwards before falling again.
- Dalton James:
(define (action-bottom y-diff) (set! curr-state y-diff) (cond ((eq? (ask BIRD 'dead?) #t) (set! bottom-states (map (lambda (x) (if (and (>= (car x) (- curr-state 10)) (<= (car x) (+ curr-state 10))) (cons (car x) -100) x)) bottom-states)) (restart-world)) (else (cond ((= (find-state curr-state bottom-states) -100) (ask BIRD 'jump) )))))
This block of code learns from the previous actions of the bird. It uses a range for the curr-state to emulate a feature based reinforcement learning approach.
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.: