Pong (Clarence, Jared)

From UBC Wiki


Authors: Clarence Chiu, Jared Chuang

GitHub Link

What is the problem?

We will create a customizable variation of the classic game pong. The game will consist of a multiplayer interactive GUI.

What is the something extra?

The game is customizable in the way that player are able to change the size of their paddle and sensitivity of their paddle (how many units moved). We will also be implementing a more difficult mode where the ball speed gradually gets faster.

What did we learn from doing this?

(This should be written after you have done the work.) What is the bottom-line? Is functional programming suitable for (part-of) the task? Make sure you include the evidence for your claims.

We learned that Haskell and functional programming is especially suitable for games because a player's action is just a function of the old game state to a new game state.

We learned that it is possible to create custom data types and access them almost like in a oop paradigm by using record syntax in Haskell, which automatically creates functions that return the elements of the data type.  

We also learned to implement and install a GUI into our game. The GUI we chose for this project was Gloss. Surprisingly, using gloss was not that difficult and we learned more about function composition and how important the ability is to pass functions into other functions.

Implementing randomization in Haskell is difficult. Especially trying to get a truly random number because given the same generator, it will produce the same random numbers in the same order. So to get a truly random number every time, two random number generators are required. One random generator to produce the first random number. The second would pass the random number produced and actually produce the random number that is wanted.

Links to code etc