Tic tac toe tutorial?

I was on it, too, and I probably came up with the worst implementation ever. That being said, I do have a working Tic Tac Toe game.

I started with an option set called OS Numbers, and it has options of 1 through 9. A 3x3 repeating group shows the grid with a type of content of OS Numbers and a data source of All OS Numbers.

I have 10 custom states at the page (index) level. 9 of the states are labeled 1 through 9, and they have a state type of text. The 10th state is labeled turn, it has a state type of number, and it has a default value of 1.

I have a group in the repeating group that has 2 workflows attached to it. The first workflow looks like this.

The first step in the workflow sets the turn custom state to 2. The next 9 steps look like this, with their custom states and conditions changed to reflect the appropriate numbers, of course.

The other workflow associated with the group is exactly the same except the first step sets the turn custom state to 1, and the next 9 steps set their respective custom states’ values to o instead of x.

Inside the group in the repeating group is an icon that shows x by default. The icon is not visible on page load, and it has 18 conditions, 9 for the x’s and 9 for the o’s.

Finally, the group itself has 9 conditions on it to stop a space from being clicked if the space is already taken.

Anyway, that’s my working Tic Tac Toe game, and I eagerly await the ridicule I might receive (and deserve) because there almost certainly has to be a better way to go about it.

1 Like