Re: [Haskell-cafe] Nomic game in Haskell

2010-04-15 Thread Dupont Corentin
Yes indeed, Nomic couldn't be fully coded, only a subset of it could be.
Rules that are outside of the box cannot be expressed, the goal is, to
have the largest box possible!

Your rule:
* Players must stand when proposing new rules.
couldn't be coded directly, of course, since the computer has no
sensor to detect the position of player ;)

But it could be indirectly. Your rule could be coded like that:
Full rule tiltle: Players must stand when proposing new rules
Code when filtering a proposed rule: A question is asked to all
players except the author of the rule: Does Player X stood when he
proposed this rule? A vast majority of Yes must be acknowlegded to
accept the rule.


On the other hand, if we choose not to interpret the rules, the
program could just be a configuration management system for rules.
It could be a web site that maintain active rules, allow player voting etc.

Corentin.



On 4/15/10, Brent Yorgey byor...@seas.upenn.edu wrote:
 On Wed, Apr 14, 2010 at 09:14:18PM +0200, Dupont Corentin wrote:
 Hello Café,
 do you know Nomic?

 It's a fabulous and strange game where you have the right to change the
 rules in the middle of the game!
 In fact, changing the rules is the goal of the game. Changing a rule is
 considered as a move.
 Of course even that could be changed!

 www.nomic.net

 I'm wondering if it could be possible to implement a Nomic (or an helper
 for
 the game) in Haskell.
 Haskell seems appropriate for that, since functions are first order
 objects,
 and Haskell is good at DSLs.

 I don't think you could actually implement Nomic in the way you
 describe, because any system you come up with will necessarily place
 restrictions on what sorts of rules you are able to represent.  Much
 of the fun of Nomic lies in coming up with new rules that are
 completely outside the box.  For example, how would you encode a rule
 like

   * Players must stand when proposing new rules.

 or

   * Rules which do not mention other rules shall remain in effect
 until such time as the mobile telephone of the Grand Counselor
 rings.

 You get the idea.

 However, implementing some sort of system for encoding certain types
 of rules, and checking that they are valid/consistent/etc. sounds like
 it could be a fun project from which you would probably learn a lot!
 Essentially, you would be designing a syntax for rules, and a type
 system for ensuring that rules are valid or used in valid ways.  It
 wouldn't be Nomic, but it could be something fun.

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

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


Re: [Haskell-cafe] Nomic game in Haskell

2010-04-15 Thread Dan Piponi
Dupont asked:

 do you know Nomic?

 It's a fabulous and strange game where you have the right to change the rules 
 in the middle of the game!

I know nomic, but as has been pointed out, it's too wide-ranging to be
captured in Haskell. So how about a game played in the Haskell type
system where you get to play whatever type you like?

Let's restrict ourselves to a total fragment of Haskell. Only allow
structural recursion and that sort of thing.

The 'board' is a Haskell type function. It'll look something like this:

type Board a b c ... y z = ...

with type variables a to z (no need to have precisely 26) and so that
the right hand side is a type, not another type function.

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

There are two players. They take turns where a turn consists of
picking a concrete type to bind to precisely one previously unbound
type variable. When there are no more legal moves left, player 1 now
has to exhibit an element of the resulting type. If they succeed, they
win, otherwise player 2 wins. Void is allowed.

For example, consider

type Board a b c d e f g = (Either a b, Either c d, Either e f, g)

Player 1 must start by making g a type they know how to instantiate.
Maybe g=Int. If not, then Player 2 chooses g=Void and they will never
be able to make one of these 4-tuples. From now on, Player 2 has sente
(to use go language) because Player 1 will always have to play in the
same factor of the 4-tuple that Player 2 played in. Ultimately,
however, Player 1 can force a win.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Nomic game in Haskell

2010-04-14 Thread Dupont Corentin
Hello Café,
do you know Nomic?

It's a fabulous and strange game where you have the right to change the
rules in the middle of the game!
In fact, changing the rules is the goal of the game. Changing a rule is
considered as a move.
Of course even that could be changed!

www.nomic.net

I'm wondering if it could be possible to implement a Nomic (or an helper for
the game) in Haskell.
Haskell seems appropriate for that, since functions are first order objects,
and Haskell is good at DSLs.

What I think, is creating a DSL where a rule could be expressed as a
function, or a monad.
Many kinds of rules could be expressed:
1. - a rule that says that player #1 must be named Grand Counselor.
2. - a rule that says that the following rules must be voted at the
majority, and how.
3. - a rule that says that the money is the ECU.
4. - a rule that says that if a rule is accepted, the author is awarded 1
ECU.
5. - a rule that says that all rules must have a name.
6. - a rule that says that democracy is abolished. God save the King, Player
#1!
7. - a rule that says that a rule mustn't suppress another.

As you can see, the rules are highly self-referencing!
some rules, like #1, describes a protocol, involving IO (players voting).
some rules, like #7, could be implemented with a test over new rules (that
rule could test proposed rules against rule suppression).
some rules, like #5, must inspect the code of other rules.

A proposed rule must pass all active rule's criterias to become active.
Once active, a rule should be applyed immediatly to all active rules, and to
all futur rules, until it is repealed.

Any comments?

Cheers,
Corentin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Nomic game in Haskell

2010-04-14 Thread Brent Yorgey
On Wed, Apr 14, 2010 at 09:14:18PM +0200, Dupont Corentin wrote:
 Hello Café,
 do you know Nomic?
 
 It's a fabulous and strange game where you have the right to change the
 rules in the middle of the game!
 In fact, changing the rules is the goal of the game. Changing a rule is
 considered as a move.
 Of course even that could be changed!
 
 www.nomic.net
 
 I'm wondering if it could be possible to implement a Nomic (or an helper for
 the game) in Haskell.
 Haskell seems appropriate for that, since functions are first order objects,
 and Haskell is good at DSLs.

I don't think you could actually implement Nomic in the way you
describe, because any system you come up with will necessarily place
restrictions on what sorts of rules you are able to represent.  Much
of the fun of Nomic lies in coming up with new rules that are
completely outside the box.  For example, how would you encode a rule
like

  * Players must stand when proposing new rules.

or 

  * Rules which do not mention other rules shall remain in effect
until such time as the mobile telephone of the Grand Counselor
rings.

You get the idea.

However, implementing some sort of system for encoding certain types
of rules, and checking that they are valid/consistent/etc. sounds like
it could be a fun project from which you would probably learn a lot!
Essentially, you would be designing a syntax for rules, and a type
system for ensuring that rules are valid or used in valid ways.  It
wouldn't be Nomic, but it could be something fun.

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


Re: [Haskell-cafe] Nomic game in Haskell

2010-04-14 Thread Brandon S. Allbery KF8NH

On Apr 14, 2010, at 19:24 , Brent Yorgey wrote:

On Wed, Apr 14, 2010 at 09:14:18PM +0200, Dupont Corentin wrote:
I'm wondering if it could be possible to implement a Nomic (or an  
helper for

the game) in Haskell.
Haskell seems appropriate for that, since functions are first order  
objects,

and Haskell is good at DSLs.


However, implementing some sort of system for encoding certain types
of rules, and checking that they are valid/consistent/etc. sounds like
it could be a fun project from which you would probably learn a lot!
Essentially, you would be designing a syntax for rules, and a type
system for ensuring that rules are valid or used in valid ways.  It
wouldn't be Nomic, but it could be something fun.



You might want to look at Fluxx, which also allows rule changes but  
with a constrained framework that should allow it to be implemented.   
(Does, actually; someone (ndm?) used to have an implementation, but  
the link to it went dead years ago.)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe