{-# LANGUAGE DeriveGeneric #-}

module Battlesnake.Core.Board where

import Battlesnake.Core.Battlesnake (Battlesnake)
import Battlesnake.Core.Coordinate (Coordinate)
import Data.Aeson (FromJSON, ToJSON)
import GHC.Generics

{-|
  The game board.
  See: https://docs.battlesnake.com/api/objects/board
-}
data Board = Board
  { Board -> Integer
height :: Integer
  -- ^ The height of the board
  , Board -> Integer
width :: Integer
  -- ^ The width of the board
  , Board -> [Coordinate]
food :: [Coordinate]
  -- ^ A list of coordinates representing food locations
  , Board -> [Coordinate]
hazards :: [Coordinate]
  -- ^ A list of coordinates representing hazard locations
  , Board -> [Battlesnake]
snakes :: [Battlesnake]
  -- ^ A list of all snakes on the board
  }
  deriving (Int -> Board -> ShowS
[Board] -> ShowS
Board -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Board] -> ShowS
$cshowList :: [Board] -> ShowS
show :: Board -> String
$cshow :: Board -> String
showsPrec :: Int -> Board -> ShowS
$cshowsPrec :: Int -> Board -> ShowS
Show, forall x. Rep Board x -> Board
forall x. Board -> Rep Board x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Board x -> Board
$cfrom :: forall x. Board -> Rep Board x
Generic)

instance ToJSON Board

instance FromJSON Board