Hi all,
As a personal project, I’ve been trying to build and extend the game of Snake in Haskell and practice my workflow and my understanding of the language. This project is heavily inspired by this blog: - however Brick has changed substantially since then.
The next part is going to go back to Brick and making a more standard UI with keyboard/mouse navigation and selectable buttons/entries in the terminal.
(ASIDE: I want the “PAUSED” text appears when the game is paused to appear overlaid on top of the game. I haven’t been able to find a way to do this yet but will research more today as I work on this)
I want to use this thread as a long-running place for asking questions/asking for critiques or pointers while I learn and implement various aspects of the infrastructure around the game.
Current state:
- The game is playable, pausable and unbeatable. It can be run with
cabal run
.nix-build
requires me to import vty someway apparently but that’s not my priority right now. - A very simple highscores database has been made as well with sqlite-simple as some helper functions to manage the database.
Desired state by next post:
- Creation of a highscores page using brick
- Highscores page can be browsed:
- Shows 10, 20 or 50 results per page, can be toggled with key
- Pages are changeable using left/right arrows
- Go to page feature so user can quickly jump to a page that is up to the maximum divisor of
Database.Highscores.maxDbSize
.
- Integration of results of the query calls onto the page.
Progress (Updated 2024-05-11):
2024-05-11: Highscore database implemented
Objectives
- [X] Database implemented to keep track of local high scores.
- [X] Database (can) prunes itself to keep only top {amount} high scores.
Database.SQLite.Simple did the job and simple SQL makes sense. It occurred to me that I used this package two years ago in the Haskell MooC. And so it was nice to reference that. I reckon I’ll need a more complex database task to really challenge myself but that’s a future task and this seems more than powerful enough to do what I needed it to do so far.
Thanks in advance,
T