Setup for Intersections & Splats

Select a configuration, and then press "BEGIN" to start your game. (If you aren't familiar with Intersections & Splats, then you may want to read the help first.)

[X] Number of guesses (1-15):

[Y] Size of code (number of digits in the code) (1-15):

[N] Number of different digits to play with (1-9):

Find out more about the INTERCAL CGI script.
Return to the INTERCAL page.


How to Play the Game

Intersections & Splats is an INTERCAL implementation of one of my favorite games, Cows & Bulls (more commonly known these days by the commercial version, Mastermind). And now it is an INTERCAL CGI script as well, which is what this page is an introduction to.

Rules of the Game

The idea of the game is that one person selects a "code" in the form of a short string of digits, typically four. (Mastermind used colors in place of numbers.) The other person has a limited number of chances to guess what the code is. Every move consists of submitting a guess, and the first player replying with a score. Each scoring reveals a little more information about the code. A guess is scored by giving a certain number of cows and a certain number of bulls. These correspond to Mastermind's white pegs and black pegs, respectively - and, in this program, intersections (+) and splats (*). (These names come from the INTERCAL language, by the way.)

This game is perfect for a computer because the person who makes the code has nothing to do but score the other player's guesses - a mechanical task.

Here's how the scoring works. For every number in the code that is matched by the same number in the same position in the guess, a splat is scored. And for every number in the code that is matched by the same number in the guess, but in the wrong position, an intersection, is scored.

For example: with a code of "3451", and a guess of "2465", one splat and one intersection would be earned. The splat is for the 4, and the intersection is for the 5. Of course, the player making the guesses isn't told which numbers earned what - that's what they have to deduce. A guess of "6152" gets exactly the same score, even though the intersection and splat correspond to completely different digits.

The game continues until the code is discovered or the player runs out of guesses.

More About Scoring

Note that there can be some confusion about how the scoring works with repeated digits. In absence of a better standards body, I have stuck with the version described in the Mastermind rules, which is that a digit in the guess can match up with more than one digit in the code. Another example is in order. Say the code is "2412". A guess of "2544" would earn one splat and two intersections. The splat is for having a 2 in the guess in the right position, and one of the intersections is also for having a 2 in the guess, but in the wrong position. The other intersection is earned by having a 4 in the guess, again in the wrong position. The second 4 in the guess, however, does not affect the scoring.

Here is an algorithmic description of how scoring is done. The computer looks at each digit in the code in turn. If the digit under consideration is matched by the same digit in the same place, a splat is earned. Otherwise, if any other digit in the guess is the same, an intersection is earned.

Play the game a few times; you'll get the idea.

The Mechanics of the Game

At every turn the board is displayed. The board shows all of the guesses you have made so far. Above each guess are the intersections and splats that they earned. Here is an example of a game in progress:

           +    
 * +  +    * *  
 (1)  (5)  (2)  ( )  ( )  ( )  ( )  ( )  ( )  ( )   (?)
 (2)  (4)  (4)  ( )  ( )  ( )  ( )  ( )  ( )  ( )   (?)
 (4)  (4)  (3)  ( )  ( )  ( )  ( )  ( )  ( )  ( )   (?)
 (2)  (6)  (5)  ( )  ( )  ( )  ( )  ( )  ( )  ( )   (?)

 IV

The first guess "1242" earned one splat and one intersection. The third guess "2435" earned two splats and one intersection. The Roman numeral "IV" (four) indicates that the game is waiting for the player to make their fourth guess.

Guesses are entered into a text entry field, situated directly below the board. After the guess is ready, the MOVE button is pushed to continue. The script will put the guess on the board and give it a score.

At the end of the game, whether you win or lose, the questions marks disappear and the code is displayed. You can then play another game with the same setup, or come back to this page and choose a different configuration.

You can leave the game at any time by selecting the EXIT link. Also, during the game, you can push the RESIGN button if you want to give up and see the code.

Configuring the Game

The game is set up originally to have ten guesses in a game, four digits in the code, and to use the digits 1 through 6. (This matches the setup of the Mastermind version.) By modifying these settings, you can control the difficulty of the game. Increasing the size of the code or the number of digits to use will make the game harder; increasing the number of guesses will give you more opportunities to gather information. (I myself often play with six digits in the code, and using all nine possible digits.)

Note that if you enter a configuration that is not within the given ranges, you will get a page with a succinct error message. Select RETURN or use your browser's "Back" feature to return here.

That's it. Have fun. Questions, comments, bug reports and inquiries into my mental health are all welcome.

Brian Raiter
breadbox [whirlpool] muppetlabs [spot] com


INTERCAL
Brian Raiter
Muppetlabs