packages feed

snake-0.1.0.0: Snake.hs

module Snake where

import Movement

data Snake = Snake { getDirection :: Direction
                   , getCoords :: [Coords] } deriving Eq

instance Show Snake where
    show (Snake direction []) = "Snake " ++ show direction ++ " []"
    show (Snake direction coords) = "Snake " ++ show direction ++ " [" ++ unwords (map showSnakeCoord coords) ++ "]" where
        showSnakeCoord (Coords x y) = "(" ++ show x ++ " " ++ show y ++ ")"