Post-Cancellation, Pre-Nisei Netrunner Rotation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
998B

  1. module State where
  2. {---
  3. - State Module
  4. -
  5. - Functions used for creating and defining the
  6. - state of the current rotation.
  7. -
  8. - Shaun Kerr.
  9. -}
  10. import System.Random
  11. import Packs
  12. -- Total State is the Datapack Pool, the Banned Big Box,
  13. -- and the next random number.
  14. type State = (Pool, BoxQueue, StdGen)
  15. -- In Rotation packs have no metadata
  16. data InRot = Ir DataPack deriving (Show, Eq)
  17. -- Out Rotation packs need a number of months
  18. -- until they're legal again.
  19. data OutRot = Or DataPack Integer
  20. instance Eq OutRot where
  21. (Or d1 _) == (Or d2 _) = d1 == d2
  22. -- Box Queue is full of Maybes for the month
  23. -- where none are banned.
  24. data BoxQueue = Bq [Maybe BigBox]
  25. -- Total pool is split into in and out of rotation
  26. type Pool = ([InRot], [OutRot])
  27. -- Simple Wrapper
  28. createInRot :: [DataPack] -> [InRot]
  29. createInRot x = map (\n -> Ir n) x
  30. -- Wrapper + Initial legality
  31. createOutRot :: [DataPack] -> [OutRot]
  32. createOutRot x = map (\n -> Or n 0) x