2006-01-21

Drools: Experimenting with «Jackal» game.

There is an old child's table game. Here http://zhurnal.lib.ru/g/glebowa_u_w/statja1.shtml an inspiration introduction can be read. Unfortunately, I have not found detail description of the game rules in the internet, but this is not so important — now I'm interested in its small subset:

The game takes place on a field consisting from 11x11 small square cells with turned over images. A player can sail his ship to any field edge and put ashore a sailor. A cell is turned over (is the image was hidden) as the sailor stand at it. Further actions depend on the cell image. I will not describe all cell types, I'll tell about 3 types, one of which roused me to program this game.

1. Empty cell — nothing happens
2. Arrow — a sailor automatically moves to a cell which the arrow is pointing at.
3. Reflection — a sailor moves to a cell, which is symmetric to its initial state.

For example:

2 3'
1 -> @ 4 1'
3 2'

where numbers are empty cells, «@» is the reflection card, well, the arrow is the arrow.

Sailor comed from cell 1 moved by the arrow to the reflection cells, which moves him to the cell 1'. Similarly for 2-2' and 3-3'. This is all rules for this cell kind, which were familiar to me, the rest special cases should be invented ;) . Since everybody has different ideas, the rules shold be programed so that they can be easyly changed later.

Here is my variant:
1. Arrows are not reflected, i. e. even if a sailor passed several arrows during the moving to a reflection cell, his further moving is symmetrical to the last empty cell.
2. But after the reflection further reflections will be relative to the result of the first one. E. g. when coming from cell 4 to the reflection cell, the sailor will be moved to the arrow, which will be reflected this time, and the sailor will be back at 4.
3. And a little exception — a sailor reflected to the reflection second time, will be reflected related to the same cell as first time.

It seems to be enough rules for this time. You can already see that this game is not like many other children's table games with fixed map representable as plane graph.

In the beginning I wanted just to set all rules and associated actions by using some rule-based engine. But I've discovered that the game field is not plane oriented graph, though it can be represented as 3-D graph. Each path containing a reflection cell can be passed through vertices located at some level. Thereby, if desired, any existing engine of a plane table game can be adapted to «Jackal» without considerable problems.

But to solve the problem of conversion Jackal field to graph I decided to try Drools engine.

No comments:

Post a Comment