11-12-2020, 10:09 AM

Hi,

Yes that syntax is correct. Here's a 3x3x3 version of Tic-Tac-Toe using layers:

(game "Graph Test - Layers (Square, 3x3)"

(players 2)

(equipment {

(board

(layers 3 (square 3))

)

(piece "Disc" P1)

(piece "Cross" P2)

})

(rules

(play (move Add (to (sites Empty))))

(end (if (is Line 3) (result Mover Win)))

)

)

U refers to the site directly above (same x and y value but greater z value).

D refers to the site directly below (same x and y value but smaller z value).

Then you have UN, UE, UNE, ..., DN, NE, DNE, ... for the angled adjacencies between layers.

The "Upward" direction matches any site with greater z value.

The "Downard" direction matches any site with smaller z value.

The adjacency between sites in different layers depends on the packing. If using the (layers ...) ludeme then yes same (x,y) on layer above and below are adjacent. But if you use a square pyramidal packing (e.g. (square 4 pyramidal:true) as in Spline.lud) then the diagonal neighbours on consecutive layers are adjacent, i.e. spheres that would touch in a full packing are considered adjacent.

The (makeFaces <graph>) ludeme creates all non-overlapping faces within the given graph. So for 3D graphs this will include 3D faces (which may not necessarily be planar polygons!). It might make sense to have an option to only find "flat" faces within each layer of 3D games.

Not sure about the layer regions or specific placement of pieces in layers... Eric can you advise?

To be honest, the (layers ...) mechanism is largely untested, please let us know if you find any glitches or ways to improve it.

Regards,

Cameron

Yes that syntax is correct. Here's a 3x3x3 version of Tic-Tac-Toe using layers:

(game "Graph Test - Layers (Square, 3x3)"

(players 2)

(equipment {

(board

(layers 3 (square 3))

)

(piece "Disc" P1)

(piece "Cross" P2)

})

(rules

(play (move Add (to (sites Empty))))

(end (if (is Line 3) (result Mover Win)))

)

)

U refers to the site directly above (same x and y value but greater z value).

D refers to the site directly below (same x and y value but smaller z value).

Then you have UN, UE, UNE, ..., DN, NE, DNE, ... for the angled adjacencies between layers.

The "Upward" direction matches any site with greater z value.

The "Downard" direction matches any site with smaller z value.

The adjacency between sites in different layers depends on the packing. If using the (layers ...) ludeme then yes same (x,y) on layer above and below are adjacent. But if you use a square pyramidal packing (e.g. (square 4 pyramidal:true) as in Spline.lud) then the diagonal neighbours on consecutive layers are adjacent, i.e. spheres that would touch in a full packing are considered adjacent.

The (makeFaces <graph>) ludeme creates all non-overlapping faces within the given graph. So for 3D graphs this will include 3D faces (which may not necessarily be planar polygons!). It might make sense to have an option to only find "flat" faces within each layer of 3D games.

Not sure about the layer regions or specific placement of pieces in layers... Eric can you advise?

To be honest, the (layers ...) mechanism is largely untested, please let us know if you find any glitches or ways to improve it.

Regards,

Cameron