Showing posts with label rules. Show all posts
Showing posts with label rules. Show all posts

Friday, August 27, 2010

Writing Game Rules

I often can't stop thinking about board games that are not completely combinatorial (they have some randomness or hidden information, etc). Often this happens in games where I'm trying to figure out exactly how the rules work.

After thinking about programming all day, it's not difficult to pick apart game rules and consider potential ambiguities. I'm teaching my algorithms class to be sure that any algorithm they write by hand be precise, and I often wish game rules were spelled out with a similar notation.

(Example using a property-type board game.)
Step 1: Set the board up according to the section Setup.

Step 2: Let p be 1.

Step 3: Player p rolls the two dice, then advances their piece clockwise around the board.

Step 4: Let s be the square containing their piece. If s contains an unowned property, continue to step ?.

Step 5: Let h be the number of houses on s and q be the player who owns the property at square s. p owes q $X where $X is the amount listed in the h-th entry of property s. Go to step 7.

Step 6: p may purchase the property... ...

Step 7: Increment p. If p is greater than the number of players, let p = 1. Continue to step 3.

Using the standard notation for Combinatorial Games, this is not an issue; all rules for play are considered the same! All the necessary information is which moves are available to each player.

Sometimes, the legal moves are not always obvious in board games, however. I've been playing Set Cubed with other members of our department, and this is a very fun game. The basic premise is a mix of Set and Scrabble, where players score points by creating new Sets each turn, filling up a 2 x 2 grid. (A 'Set' is a triple of pieces where, for each property of the pieces, either all three have the same value or all three have different values. (Each property can have one of three values.)) The rules for this game are available here, including many nice pictures.

In the game, an often-occurring move is to play a piece that creates a set in one direction (horizontally or vertically), but doesn't in another, even though it lines up with those pieces. This is perfectly legal, which is clear according to the rules. On a turn, a player may play up to three dice on the board. What is not clear is whether those dice must be played one at a time, pausing in-between to determine the legality of that play alone, or whether a first die may be followed immediately by a second so that the trio form a set, even if the first doesn't create any.

As it turns out, you have to allow this in order to play in other directions besides a straight line, but later on it seems awkward to play a piece that creates one or more non-Set groups of three, then immediately cover that up with a second piece. It could be that this is not legal!

Since it looks like my lunch group will be playing this game a lot, I emailed the makers of Set for a clarification. They responded very quickly and told me that this is legal, as examples were shown in the online tutorial.

Either way, I'd like to try playing under both rules! This is a very nice game that employs a nice amount of randomness without removing all the strategy involved. Also, it is not trivial each turn to see where your available moves are, as it is not trivial to see all set combinations. It also removes the speed aspect of Set, as players take distinct turns instead of calling out the Sets they see.

Monday, October 5, 2009

Algorithms and Game Rules

Most of my posts have had the underlying theme of writing algorithms to play games well, but coming up with the rules for games is also a good exercise in algorithms.

In fourth and seventh grades we were asked to create board games for school. A big difference between the two assignments was that in seventh grade we were asked to actually write out the rules. Although this was for a social studies class, our teacher made it plain that we needed to be very clear with these rules; don't assume the players automatically know how to do everything. She also stressed making it clear that the rules should repeat: after one person's turn, the game should move on to the next player.

Combinatorial games are beautiful in part for the simplicity of the unifying design. To describe a new game, it is enough to describe what the left and right children of any state are. Moving to the next person's turn and when the game ends are all built into the overriding definition. For generic board games, however, enough is going on during one turn that algorithmically describing the steps is more worthwhile.

Roll the dice,
move your piece clockwise around the board that many spaces,
if you land on unowned property, you may buy it
otherwise, if you land on owned property, you must pay that player the appropriate amount
otherwise, if you land on...

If I ever get teach a freshman seminar on board games, I will definitely integrate creating our own board games. Creating rules and the prototype has a lot to do with software design, and that process would be very useful!

Thank you, Mrs. Pasco. Your social studies course gave me the best computer science lesson of that school year!

Friday, October 2, 2009

Another Rules Change

Sometimes I wonder how much players should expect board game designers to get the rules right the first time. It seems to me that there are lots of games being published these days and it might be difficult to detect all the errors prior to publication. Still, I am often surprised at what is either a small amount of playtesting or a bad translation of playtesting to actual rules.

Having said this, I know I am already guilty of not getting to do enough playtesting when it comes around to designing new combinatorial games. It's hard to see how a game will play out unless you can find opponents, which I assume is more difficult in the academic setting as opposed to an actual game manufacturer. Still, it does seem reasonable that small pieces may be missing from a rule (for example, a stalemate rule). It's nice when the solution to these is easy enough to see and implement.

I'm having a more difficult problem resolving a conundrum with Ninja versus Ninja. I've mentioned this game before, but after posting on the topic of confusing/incorrect rules this week, it again jumped into my head.

To quickly explain the uncertainty, this page describes the different possible moves in one turn after a throw of the two four-sided dice. The goal is for your ninja to infiltrate the opposing dojo and either end your move on one of their ninja (thus eliminating them from the game) or just returning for a number of points equal to the distance your ninja was able to infiltrate. Ninja only have three turns to leave their dojo and return, so you do not often hang out in enemy territory. Instead, ninja will often use the reverse move to go deep and then turn around.

In order to prevent the easy capture of ninja, movement is restricted to either going in a straight line or an L-shaped move, and jumping of other ninja (even your own) is not allowed. The reverse allows your ninja to move in a straight line, then turn back around at one point, though this is only allowed in the opponent's dojo. The rules then suggest that a good strategy is to move your ninja directly next to an opponent's ninja, since then "there is no way for that Ninja to eliminate your piece (the two dice can only roll the numbers 2–8)".

This isn't true, however! If they roll an odd number (and are in your dojo and are deeper in your dojo than your piece) they can move further in and then reverse into your ninja. If they roll a 2 and a 3 on the dice, they can move forward two spaces, then reverse three, landing on your ninja they were initially next to.

That seems mostly legal. It plays pretty well and can be a bit hard to make happen (see all the requirements above). Sadly, it means that the strategy of moving your piece in position to attempt to block them getting back to the dojo doesn't really work.

Even more unclear and potentially damaging is the use of combining an L-move and a reversal. In this scenario, a ninja is moved a few squares sideways (not deeper into either dojo), then towards the opponent's dojo, then reverses and heads backwards. Everything seems to work fine during the reverse---so long as you don't reverse past the space you turned at. For instance, a ninja who has 6 spaces to move could move 1 square to the left, then forwards 2 squares, then backwards 3. In this way, the ninja is essentially able to land on (and kill) a piece one square left and one square backwards from it's starting position, even though it didn't roll a 2. This combination is often too strong.

My fiancee and I have changed this to not allow the reversing-with-an-L ninja to use more spaces than occur in the L-shape. Thus, the ninja cannot move further backwards than forwards. This is a pretty tame change, though it plays a lot better than allowing the rules as they appear to be stated.

Other potential rules alterations I would consider:

1) Don't allow ninja to move further backwards than forwards on any reversal. This would actually prevent the can't-kill-neighboring-ninja statement the "strategies" part of the rules claims is impossible.

2) Allow ninja to move further backwards than forwards on reversals, but only if the move does not end them on another ninja. This allows more liberal reversals, but still restricts the ninja from using it to capture other ninja.

3) Don't allow reversals at all. (I want to try playing this way.)

Perhaps there are not many Ninja Versus Ninja players out there at this point, but if anyone has played this game and had a similar problem, please let me know!

On the other hand, which other games (seem to) need a change to the rules to make them (more) playable?

Monday, September 28, 2009

Avoiding Loops and Rewriting Rules

Some games, such as Tic-Tac-Toe, have a clear maximum number of moves. Either the game ends before nine moves have been made, or the ninth move is the last. On the other hand, there are games that don't have such a trait; they have the potential to run an unbounded number of turns.

When I was a kid, I enjoyed playing Stratego with my grandmother. One of the (very sensible) rules that often got me into trouble was the non-repetition rule: a piece cannot be moved back and forth between the same two spaces more than three times in a row (or something similar). Another example is the following rule in Oshi:
Stalemate
When you move one of your pieces, you cannot end its move in the same space it occupied at the beginning of your previous turn.
Oshi is all about moving your pieces around a grid and trying to push the opponents' pieces off the board. It's an excellent game, and this rule prevents a lot of potential "loops" from occurring. By loop, I mean a situation where the sequence of game states repeats. This could potentially still happen in Oshi if two players play a little back-and-forth dancing game between two different pairs of stalemating pieces. Many unbounded-turn games have this difficulty and these sort of loops (which can force stalemates) can often not be easily ruled out through the addition of these sort of stalemate rules.

Unfortunately, however, there are often situations in Oshi where the above stalemate rule fails. As I mentioned above, the game pieces are used to push opponents' pieces off the board. In a very basic case, if there were two pieces (of the same size) they could push each other the same distance. For example, the red piece could push the white piece towards the board's edge. On the white player's turn, the white piece might want to push back, moving both pieces back towards the the other edge.

The red player would likely want to respond by pushing back. The white responds by doing the same thing back, and the game loops. Unfortunately, this very simple repetition and often happens during the game. It happens in almost this exact situation, but also in more complex situations. You get pushed, and you immediately respond by pushing back. This seems like a good strategy, but leads to these bad situations. Thus, for a few years, I've been using the following replacement for the above published rule:
Stalemate
When you move one of your pieces, you cannot end its move in the same space it occupied at the beginning or end of your previous turn.

The rule is only slightly changed, but it makes Oshi far more playable. If you're about to start a game, I highly recommend playing this version!