Skip to content

will-clarke/snake-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake written in Haskell

./media/haskell-snake.gif

Cool features

  • Command line arguments: alter the dimensions, the seed & ASCII style
  • Pausing / resuming (‘p’)
  • Replaying your last game (‘r’)
  • High scores (for given window sizes)
  • Seeding
  • Speed up with Spacebar
  • Speeding up when you eat fruit

How to run

  • Make sure you’ve got stack installed. Then:
git clone https://github.com/will-clarke/snake-haskell
cd snake-haskell
stack run

Dev TODOs:

  • [ ] backwards mode: keys do the opposite of what you expect (/ something totally random)
  • [ ] make snake head a different colour
  • [ ] high scores stored on a server somewhere?????
  • [ ] changing background colours depending on the level ----- DO WE EVEN WANT THIS?
  • [ ] Find out how to get screen dimensions from Brick. This could be tricky / monad-y
  • [ ] parsing – some DSL for styling / add a map
  • [X] only change dimensions with command line arguments
  • [X] Make the game faster as you eat more fruit
  • [X] show high scores
  • [X] update high scores
  • [X] Make sure all record-syntax functions are sytematically named (eg. “getSomething”)
  • [X] high scores stored locally?
  • [X] start snake in the middle
  • [X] Start snake moving left to right or something
  • [X] implement pausing / resuming on screen blur / focus
  • [X] make it so you can’t move further from the boundary
  • [X] add an endgame screen
  • [X] add a pre-game screen
  • [X] Make head of snake a different colour
  • [X] (related to below): allow command line args to toggle between simple / complex graphics
  • [X] Add attributes to make it pretty
  • [X] Colour in the snake
  • [X] Colour in the Food
  • [X] Actually make pretty attributes pretty
  • [X] move stdgen into food
  • [X] rename model
  • [X] remove keypress
  • [X] Don’t allow snakes to turn on 180 degrees
  • [X] Reseed food after it’s eaten
  • [X] Allow Food to be eatable
  • [X] Make food increment the score
  • [X] command line – pass in initial seed. Optparse-applicative. Maybe different game modes (eg. just left-right)

Next projects ideas:

  • Parse “One hundred and twenty eight” into 128
  • Parse cron
  • Invent regular expression language
  • Invent L-System turtle thing

About

Snake written in Haskell. Check out the readme for a gif!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published