-- | Internal representation of the Chu Shogi board at a given instance in time -- Copyright 2009 Colin Adams -- -- This file is part of chu-shogi. -- -- Chu-shogi is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- Chu-shogi is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- You should have received a copy of the GNU General Public License -- along with chu-shogi. If not, see . module Lighting ( -- * Types Lighting_colour (..), -- * Status report is_lion_a_pair, is_lion_b_pair, is_capture ) where import Coordinate -- | Type of move possible onto a 'Square'. Distinguished by colour on the GUI. data Lighting_colour = Step_lighting -- ^ Ordinary step or ranging move | Jump_lighting -- ^ Jump move | Lion_b_lighting -- ^ Second square for lion-type moves | Lion_a_lighting -- ^ First square for Lion-type moves | Step_capture -- ^ Ordinary step or ranging capture | Jump_capture -- ^ Jump capture | Lion_b_capture -- ^ Second square for lion-type captures | Lion_a_capture -- ^ First square for Lion-type captures deriving (Eq, Ord, Show) -- | Is item a one-step lion move target? is_lion_a_pair :: (Coordinate, Lighting_colour) -> Bool is_lion_a_pair item = case item of (_, c) | c == Lion_a_lighting || c == Lion_a_capture -> True _ -> False -- | Is item a two-step lion move target? is_lion_b_pair :: (Coordinate, Lighting_colour) -> Bool is_lion_b_pair item = case item of (_, c) | c == Lion_b_lighting || c == Lion_b_capture -> True _ -> False -- | Is item a capture? is_capture :: (Coordinate, Lighting_colour) -> Bool is_capture (_, l) = case l of Step_capture -> True Jump_capture -> True Lion_b_capture -> False Lion_a_capture -> False