Course:CPSC312-2023/Sokoban

From UBC Wiki

Authors: Caden Lu, Mark Ippolito, Tanner Bowie

Contents

What is the problem?

We will be implementing a project based on the game Sokoban. This project will take real time inputs from the user, change the game state based on their input, and display our game state.

What is the something extra?

We will also implement a solver for our puzzle, using BFS and removing duplicate states.

What did we learn from doing this?

We learned how to implement a 2D grid-based game in Haskell. The functional programming paradigm worked well with this game, as the state only changes in response to player input. We were able to use an ‘act’ function which interpreted player action to return an updated state, which was then rendered and the process repeated. We were also able to make use of Haskell features to cleanly separate different parts of the code, such as using a type class ‘GameInterface’ to describe the desired functionality of any user interface (in our case with the command line) for the game. This meant we could have the core logic purely functional, and limit use of IO side effects to be controlled by the interface.

Links to code etc

https://github.com/cadenlu121/Sokoban