From UBC Wiki

Kingdom of Zed Solver

Authors: Nicholas Chim, Cynthia Deng

What is the problem?

We will be writing a solver for the Kingdom of Zed problem.

Repo Link:

What is the something extra?

We will be implementing the following 'additional functionality' tasks as our something extra, namely:

  • Allow maps of Zed or arbitrary size, i.e. any n×n map for n >= 2.
  • Allow incomplete information. For this option, merchants may withold information from you. If they do, their clue is represented as a 0 (zero).
  • Display the output as a grid (not a list).

What did we learn from doing this?

We've determined that Haskell is a pretty good candidate for implementing a solver. While it neither an easy, or short task for us, the amount of code our final product ended up with was surprisingly little. It's pretty clear that people well versed in functional programming would be able to whip up fairly complex programs without as much effort as compared to traditional imperative programming languages.

We've also learnt how essential it is to break the problem down into smaller parts. To implement our brute force solver, we started by isolating lines in the grid, then validating that the line of posts was valid, building up to validate the entire board and so on. Separating the functionality into distinct sections helped us greatly in debugging issues and bugs. Each time we noticed a problem, we were able to immediately isolate it to a specific part of the program, and create new test cases to ensure we've fixed it.