[Haskell-cafe] Re: Nomic game in Haskell

2010-04-15 Thread Ashley Yakeley

On 2010-04-15 14:00, Dan Piponi wrote:


(A neutral third party will have to implement Board.)


data Three a b c where
{
  MkThree :: Three () () ()
}

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)
 )))

Player 2 wins, I think.

--
Ashley Yakeley
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Nomic game in Haskell

2010-04-15 Thread Dan Piponi
On Thu, Apr 15, 2010 at 4:58 PM, Ashley Yakeley ash...@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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Nomic game in Haskell

2010-04-15 Thread Ashley Yakeley

On 2010-04-15 17:39, Dan Piponi wrote:


In the service of readability we could also define:

data X = X
data O


In that case we'd want

  type Three a b c = (a,b,c)

...which is simpler than my GADT.

--
Ashley Yakeley
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe