# FlappyBird

Mike Begonis
Dalton James
December 8, 2014

## Overview

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.

## Concepts Demonstrated

• 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)
(cond [(< velocity min-velocity)
(set! JUMPING #f)
velocity]
[else (ask self 'inc-velocity (* -1 jump-accel))])
(cond [(> velocity max-velocity)
```

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
(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)