#!/bin/bash
#
# Copyright (C) 2007 Loic Dachary <loic@dachary.org>
#
#  This package 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; version 2 dated June, 1991.
#
#  This package 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 this package; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#
# https://gna.org/support/?1823
# Run thru all poker-eval/lib/enumerate.c #define INNER_LOOP(evalwrap)
#
set -e

r=$(../examples/pokenum -o8 As Kh Qs Jh Ac Kd 5d 7h -- 8s Ts Jc)
e=$(cat <<EOF
Omaha Hi/Low 8-or-better: 820 enumerated boards containing Ts 8s Jc
cards         scoop     HIwin   HIlos   HItie     LOwin   LOlos   LOtie      EV
As Qs Kh Jh     500       715      15      90         0       0       0   0.796
Ac Kd 5d 7h      15        15     715      90       224       0       0   0.204
EOF
)
if test "$r" != "$e" ; then
  diff -u <(echo "$e") <(echo "$r")
  exit 1
fi

r=$(../examples/pokenum -o8 As 7h 6s 5h Ac 7d 6d 5d -- 8s Ts Jc)
e=$(cat <<EOF
Omaha Hi/Low 8-or-better: 820 enumerated boards containing Ts 8s Jc
cards         scoop     HIwin   HIlos   HItie     LOwin   LOlos   LOtie      EV
As 6s 7h 5h     250       324       0     496         0       0     168   0.675
Ac 7d 6d 5d       0         0     324     496         0       0     168   0.325
EOF
)
if test "$r" != "$e" ; then
  diff -u <(echo "$e") <(echo "$r")
  exit 1
fi

r=$(../examples/pokenum -o8 As 7h 6s 5h Ac 8d 6d 5d -- 2s Ts Jc)
e=$(cat <<EOF
Omaha Hi/Low 8-or-better: 820 enumerated boards containing Ts 2s Jc
cards         scoop     HIwin   HIlos   HItie     LOwin   LOlos   LOtie      EV
As 6s 7h 5h     289       381     352      87        12       0     157   0.504
Ac 8d 6d 5d     314       352     381      87         0      12     157   0.496
EOF
)
if test "$r" != "$e" ; then
  diff -u <(echo "$e") <(echo "$r")
  exit 1
fi

