Course:CPSC312-2017-Kingdom-of-Zed-Madi-Vaibhav

From UBC Wiki

Kingdom of Zed

Authors: Madison Graf, Vaibhav Sokhi

Link: https://github.com/madigraf/312-Kingdom-of-Zed

What is the problem?

We chose to do the given well-defined project to create the Kingdom of Zed game/solver.

http://www.cs.sfu.ca/CourseCentral/383/pjj/a1.html

What is the something extra?

For the "something extra" we will implement some of the "Additional Functionality" bonuses from the project specification.

What did we learn from doing this?

This project was generally split into 2 parts: the game solver, and the interactive UI.

Haskell was very well-suited to the task of creating the game solver, using list comprehension and lazy evaluation to generate and check a list of possible solutions. This allowed us to create an efficient algorithm without any extra work on our end; due to lazy evaluation, when searching for a solution the algorithm will only generate valid n x n boards until a valid solution is found, rather than generating a list of ALL possible boards, as many other languages/compilers would do.

Another aspect that we had to learn was how system I/O works in Haskell. Under normal circumstances, Haskell's way of doing functions works well for your average function, but it can quickly become messy when attempting to mix system I/O and recursion. With that being said, it's great that Haskell gives you the ability to compose pseudo-imperative functions for system I/O using "do" as it allows the programmer to code them as in a much more readable manner. Aside from system I/O, we also got to utilize Haskell's parsing implementation. By using both built-in functions and some of our own, we managed to parse user inputs into a multitude of types. Furthermore, toying around with Haskell's parsing furthered our appreciation for lambdas and higher-order functions as they facilitated clean parsing.