[Haskell-cafe] Type system game (was: Nomic game in Haskell)

Dupont Corentin corentin.dupont at gmail.com
Fri May 7 11:28:34 EDT 2010


Hello,
I think your type should be:

type Board a b c d e f g h i =
  Either (Three a b c)
  (Either (Three d e f)
  (Either (Three g h i)
  (Either (Three a d g)
  (Either (Three b e h)
  (Either (Three c f i)
  (Either (Three a e i)
            (Three c e g)))))))

as far as i can understand, it seems thats it's mandatory for Player 1
to play in a,b,c to win?
So victory should go to player 2?

Cheers,
Corentin

On 4/16/10, Dan Piponi <dpiponi at gmail.com> wrote:
> On Thu, Apr 15, 2010 at 4:58 PM, Ashley Yakeley <ashley at semantic.org> wrote:
>
>> type Board a b c d e f g h i =
>>  Either (Three a b c)
>>  (Either (Three d e f)
>>  (Either (Three g h i)
>>  (Either (Three a d g)
>>  (Either (Three b e h)
>>  (Either (Three c f i)
>>  (Either (Three a e i)
>>  (Either (Three c e g)
>>  )))))))
>
> In the service of readability we could also define:
>
> data X = X
> data O
>
> Though the victory conditions aren't precisely the usual ones.
> --
> Dan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list