forked from nionita/Barbarossa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The identity is changed on Barbarossa, other small changes, it compiles
- Loading branch information
Showing
25 changed files
with
5,339 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Eval.BasicEval ( | ||
matPiece | ||
) where | ||
|
||
import Data.Array.Unboxed | ||
import Data.Array.Base | ||
import GHC.Arr (unsafeIndex) | ||
|
||
import Struct.Struct | ||
|
||
matvals :: UArray Piece Int | ||
matvals = listArray (Pawn, King) [ 100, 325, 325, 500, 975, 20000 ] | ||
|
||
matPiece1 :: Piece -> Int | ||
matPiece1 Pawn = 100 | ||
matPiece1 Knight = 325 | ||
matPiece1 Bishop = 325 | ||
matPiece1 Rook = 500 | ||
matPiece1 Queen = 975 | ||
matPiece1 King = 20000 | ||
|
||
{-# INLINE matPiece #-} | ||
matPiece :: Color -> Piece -> Int | ||
{- | ||
matPiece c p = case c of | ||
White -> matPiece1 p | ||
Black -> - matPiece1 p | ||
-} | ||
matPiece White = unsafeAt matvals . unsafeIndex (Pawn, King) | ||
matPiece Black = negate . unsafeAt matvals . unsafeIndex (Pawn, King) |
Oops, something went wrong.