Course:CPSC312-2023-Wordle with GUI

From UBC Wiki

Authors: Andy, Lauren, Alvin

What is the problem?

We will be investigation whether or not Haskell is well suited for game development and graphical user interface creations. Furthermore, we will learn about the advantages and disadvantages of different "library package managers or application templates". What we mean by this is we would be recreating the project such that one version can be recreated by any user using `cabal install` lines and the other version is a "stack application" where users would be using commands like `stack build` and `stack ghci` to get things running. We would be comparing how difficult developing an application would be using both methods. In each version (with cabal only vs with stack), we will be recreating the game wordle with 2 playing options where:

1) Wordle is completely played in the command line. Statistics of how many wins and losses a player has is maintained so long as the player continues to play.

2) Wordle is only played once. At the end of the game, the answer, along with a congratulatory or encouraging message, is revealed in a GUI pop up.

So in total, there are 4 different ways to play our Wordle game, allowing us to explore the different options of development thoroughly.

What is the something extra?

1) We would be investigating multiple GUI packages. For this project, we used Gloss, but have tried others like GTK.

2) We would be investigating which "package manager" makes it easier to develop applications (only using `cabal installs` vs a `stack application`)

3) We would be incorporating randomness (at the time of the project release, randomness was not covered in class)

What did we learn from doing this?

Haskell itself is fine for game and GUI development. Using cabal installs only seemed to be better for small application development since to run the application, we only run the basic `ghci` command. In contrast, using a stack application requires us to run stack build` and `stack ghci` which takes much longer to load up than just running `ghci`. For larger projects, stack projects have a `stack.yaml` which comes in handy in terms of defining dependencies. Furthermore, the more packages our application relies on, the better it is to use a stack project. This is because we would not have to run `cabal install` for each and every dependency where as `stack build` and `stack ghci` handles installing the dependencies. We learned that randomness is very easy to implement (can be done using only one library).


We also learned that while Haskell, the language, itself is fine for game and GUI development, there are very few tutorials / readable documentation for Haskell libraries. Hence there is a very steep learning curve to learning how to use a new package, let alone using it for complex features. There is just too little online support for this language and anything associated with it. Packages like GTK require a very high amount of complicated steps to get running which would discourage users from using it. There needs to be stronger documentation and more code examples for how to install and use these packages.

Links to code etc

Instructions to run either the stack application or just the regular haskell file can be found in the README file of the repository.

https://github.com/AndyLiang1/CPSC-312-Assignment-1-Haskell