-- | Normal move evaluator -- 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 Evaluator ( -- * Access value_for_black ) where import Game_state import Board {-# contract value_for_black :: Ok -> {r | r <= (maxBound :: Int) - 3 && r >= (minBound :: Int) + 4} #-} -- | Standard evaluation function value_for_black :: Non_interactive_state -> Int value_for_black ni_state@(_, board', (w_kings, b_kings, _)) = let v = case w_kings == 0 of True -> (maxBound :: Int) - 3 False -> case b_kings == 0 of True -> (minBound :: Int) + 4 False ->case is_bare_king ni_state of True -> case is_white_bare_gold ni_state of True -> (minBound :: Int) + 4 False -> (maxBound :: Int) - 3 False -> position_value board' in case is_black_to_play ni_state of True -> v False -> -v