Message Boards Message Boards

The Voronoi game

Posted 9 years ago

Voronoi (the game)
1. Ten random points in a grid make Voronoi cells.
2. Players R and B alternate placing points on the grid for red and blue Voronoi cells. (Alt+click)
3. First to connect three sides wins.

Here's some code I came up with for it.

DynamicModule[{p=RandomReal[{-1,1},{10,2}]},LocatorPane[Dynamic@p,Dynamic@Show[VoronoiMesh[p, 
ImageSize-> {500,500}, MeshCellStyle->Table[{2,n}-> If [n>10,If[OddQ[n],Red,Blue], Gray],{n,1,Length[p]}]],
 Graphics[Table[{If [n>10,If[OddQ[n],Red,Blue], White],Text[n,p[[n]]]},{n,1,Length[p]}],ImageSize-> {500,500}]],
LocatorAutoCreate->True, Appearance-> None]]

Voronoi game

It doesn't quite work, though -- the cell order doesn't correspond to the Point order. That makes the game a lot more random.

So... some questions.
1. Is there a good strategy for the current random game?
2. Is there a fix for the code? Can it be made shorter?
3. Is there a strategy for the fixed game?
4. Can an AI be made for one or both of the colors?
5. If the game is too easy with 10 initial points, how many points make the game interesting?

Attachments:
POSTED BY: Ed Pegg
2 Replies

Cool concept! But "three sides" of what? - Do you mean "three sides" of the square field?

POSTED BY: Sam Carrettie

Yes, three sides of the square field. A similar game is Y, where the winner connects three sides of a triangle. In Hex and games like it, there is a pair of opposing red sides and a pair of opposing blue sides.

A search on "Voronoi game" shows some implementations. In one version, the winner is the person with the greatest total area after some given number of turns.

POSTED BY: Ed Pegg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract