summaryrefslogtreecommitdiffstats
path: root/src/CPUPlayer.hs
blob: a9eb6d8c8033a3115973c3c012c46399956f0c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE DeriveDataTypeable #-}

module CPUPlayer ( CPUPlayer(..)
                 ) where


import Data.Fixed
import Data.Ratio ((%))
import Data.Typeable

import GLDriver
import Player


data CPUPlayer = CPUPlayer Micro
                 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 angle) _ = return (CPUPlayer (if (angle+0.2) > 180 then angle-359.8 else angle+0.2), Just angle, True, Just (-angle), False)