{-# LANGUAGE DeriveDataTypeable #-} module CPUPlayer ( CPUPlayer(..) ) where import Data.Typeable import Transformable import Vector import GLDriver import Player data CPUPlayer = CPUPlayer Rotation deriving (Typeable, Show) instance Player CPUPlayer where -- playerUpdate (CPUPlayer angle) _ = return (CPUPlayer (if (angle+0.2) > 180 then angle-359.8 else angle+0.2), Just angle, True, Just (-angle), ((fromIntegral . round $ angle) == angle) && ((round $ angle) `mod` 2 == 0)) playerUpdate (CPUPlayer dir) _ = return (CPUPlayer dir', Just dir', True, Just $ negateV dir', False) where dir' = (fromAngle (0.2*pi/180)) >< dir