Frogs and Toads Are Friends
Toads and Frogs, according to the Wikipedia article of the same title, was invented by Richard Guy as a game between two players, with the rules constrained by simple mathematics.
It can be thought of as a board game, like on a chess board, except we only take 1 row of eight of uncolored squares. The three leftmost squares start with one toad on each of them, the three rightmost squares with one frog each, and the middle two remain empty.
One player controls the toads, who want to reach the right side, and the other controls the frogs, who want to reach the left side. The game proceeds through each player alternating in taking moves towards the goals of the animals they control, and in order for one of them to win, the other must not be able to take a turn allowed by the rules.
The rules are as follows:
- A player's turn consists of moving exactly one animal they control.
- A player may not move an animal onto a square already occupied by another animal.
- The following list all legal squares that an animal can be moved onto, subject to the previous condition:
- The square directly adjacent in the direction the animal is moving, if it isn't beyond the end of the board. (E.g., the square to its immediate right for a toad, the immediate left for a frog).
- The square that is two squares away in the direction the animal is moving (i.e. the other square that the square mentioned in the previous bullet is adjacent to) if it exists, and only if the square mentioned in the previous bullet is occupied by an animal of the opposite type. (For example, for a frog, it can hop over a toad but not a frog or an empty square. A toad can hop over only a frog, not another toad or an empty square. Neither toads nor frogs can hop over and out of the board.)
An interesting property of these rules is that for each turn the selection of which frog or toad to move determines which square it could land on, since not both of the squares mentioned can be allowed moves at the same time.
Below is an interactive way for you to try out the game, either to play against yourself or play with another person on the same device. The box labelled "Board" will contain the board of squares, and to take a turn you can just click on the frog ("F") or toad ("T") to move. The player controlling the toads will make the first move. Any attempt to make a move not allowed by the rules or to make a move out of turn order (alternating toads and frogs) will result in no change to the board. The board will also indicate if there is no possible move left.
The box labelled "Restart" contains buttons to reset the board to what it would look like at the start. Each button represents a different board size and different number of animals per player.
Lastly, the box labelled "Undo" contains buttons to undo the last moves played on the board, with each button undoing a different number of moves.
The above were implemented using techniques I learned from Chris Fernandi's website, specifically these two blog posts: post 1 and post 2.
This game is also one of many games studied as examples in the first volume of Winning Ways for Your Mathematical Plays written by Berlekamp, Conway, and Guy and published by A K Peters out of Wellesley, Massachusetts, United States. I haven't thoroughly studied the volume but it brings up an interesting notion of numbers.
Specifically, it describes a concept of assigning a number to a two-player game, roughly described as the number of turns needed to counteract the advantage one of the players has. Eventually the possibilities of this value deviate from the integers, and the volume brings up more abstract concepts like the addition of two games, the negation of games, and games whose value isn't positive, negative, or zero.
I can't say I'll come back to this topic but it is a neat one to learn about.
Footnote: more specifically, Winning Ways talks about games where
- the duration of a game consists of players alternating to move from a given position (e.g. an arrangement of pieces on a board) to another
- the moves a given player may take are limited by a fixed, known set of rules
- every single action a player takes has no element of chance in terms of its outcome
- the game's rules decide that the outcome is based on when a player is no longer able to make a move allowed by the rules, and
- the game will end, at some point (i.e. it is impossible for the game to go on forever).
Also, the title of the blog post refers to the book Frog and Toad are Friends, the first of a series of children's books known as the Frog and Toad series that according to Wikipedia was written by Arnold Stark Lobel. I learned about the series from a picture of a cover somewhere online and found the cover cute.
According to the Wikipedia page about him, Lobel passed in 1987 while battling acquired immunodeficiency syndrome (AIDS).
- ← Previous
Abstract noun generator