After modeling a game strategy, you may wish to execute your game strategy to watch your results. This section will conclude the steps that need to be done to connect your game strategy to the Chainreaction game in order to test it. In short, these steps are:

A starter graph is a graph template that allows you to run the Chainreaction game quite easily. These graphs can be generated by clicking the Icon or by selecting Plugins → Chainreaction → New Starter Graph.

Note: In case you already created a starter graph, it is not neccessary to create a new graph for every game strategy.

A generic square placeholder image with rounded corners in a figure.

Select the game strategy you wish to test from the graphs tab in your browser area. In contrast to the usual way of adding an activity, hold Ctrl while you drag and drop the game strategy into the starter graph model. This way, a constructor activity is created (more on constructors in the Advanced Modeling Tutorial ). You can distinguish a constructor activity from other activities by its overlay icon: constructor activities have an asterisk ..

A generic square placeholder image with rounded corners in a figure.

The activity need to be marked with an asterisk icon.

Since the new activity is a constructor, it creates a new instance of our game strategy. This instance must now be passed to the starter graphs context. When you hover over the constructor, the two arrows for input (blue) and output (orange) appear. Since the instance is passed as result (ergo output) after the constructor’s execution, click the orange output arrow and select the success branch. You will see the window with the results of that branch, which is only our desired game strategy instance.

A generic square placeholder image with rounded corners in a figure.

The output of the constructor graph (instance) needs to be stored in the context variable.

This output now must be handed over to the context, which is done by writing it into a context variable. The two existing context variables in the inspector area will be used to determine the first and second player. Drag and drop the selected instance output parameter onto the context variable firstGS and click the use Existing button. This takes care of the data flow, so the last thing remaining is the process flow.

The start activity has to proceed to the constructor activity, which then proceeds to the already existing startChainreaction activity. Connect those with edges and choose the success branch for both of them. Finally, your starter graph should look like this:

A generic square placeholder image with rounded corners in a figure.

A complete starter graph, iincluding a constructor activity and the respective branch.

Now that the starter graph is completely modeled, it can be executed. To do so, click the Icon or select Plugins → Tracer → Run from the menu bar. The Chainreaction game will now start and will allow to play against the game strategy. Before actually placing a token, the game strategy will display a window with all its assigned cell values. A -1 value represents a cell that cannot be placed upon, every other value is the cell value that was given to that cell.

Closing the popup window will continue to place a token for the game strategy, after which its turn ends.

Note: you can also close the popup window by pressing Esc, ↲Return or Enter.

Game Strategy vs Game Strategy

To let a game strategy play against another (or itself), simply add a second constructor activity to the starter graph and write that constructor’s output instance into the context variable secondGS.

Afterwards make the first constructor proceed to the second constructor, which then proceeds to startChainreaction.

A generic square placeholder image with rounded corners in a figure.

An example for a starter graph that lets two game strategies play versus each other.

When running the starter graph now, the two strategies will play against each other, both displaying their own cell values before placing.