Introduction
A childhood game designed to help children learn to count in french in Canadian schools is played as follows:
- Students go around the room counting up to 11
- A number greater than 11 cannot be said
- A student can say either 1, 2, or 3 numbers
- If a student says the number 11 then they are removed from the next round and play begins again at 1
- The game continues until there is 1 player remaining
Consider the simple example:
Player1 | Player2
01 |
02 |
03 |
| 04
| 05
| 06
07 |
08 |
| 09
10 |
| 11
Player 1 wins
The rules
- Design a program which takes in an integer greater than or equal to 2 and less than or equal to 99 (for formatting reasons) and outputs the game played by this number of bots
- Play will begin with bot1 and increase to the highest number bot
- Play will cycle back to the beginning when the final bot is reached
- Bots will randomly output the next 1, 2, or 3 numbers UNLESS
- Outputting 2 or 3 numbers will cause them to lose on that turn.
- If the count is 8 when it reaches a bot, it should only decide between
9
and10
- If the count is 8 when it reaches a bot, it should only decide between
- Outputting 2 or 3 numbers will cause them to go over 11
- Outputting 2 or 3 numbers will cause them to lose on that turn.
- Output numbers and bot numbers should be formatted to take two characters (i.e. you can format numbers to be
01
,_1
, or whitespace, whatever makes you happy) - Each column should be 2 characters wide separated by
|
as well as a|
at the beginning and ends of rows - Once a bot is out the remainder of their column should be filled by
xx
- When there is only one bot remaining he is the winner
- The program will announce which bot was the winner in the form of
Bot #N is the winner
- This is code-golf so shortest byte count wins
Formatting examples
|01|02|03|
|01| | |
|02| | |
|03| | |
| |04| |
| | |05|
| | |06|
|07| | |
| |08| |
| |09| |
| |10| |
| | |11|
|01| |xx|
|02| |xx|
|03| |xx|
| |04|xx|
| |05|xx|
|06| |xx|
| |07|xx|
|08| |xx|
| |09|xx|
| |10|xx|
|11| |xx|
Bot #2 is the winner
Option
The outputs can get long so you are permitted to output only the final number of the bots turn for example the above output becomes instead:
|01|02|03|
|03| | |
| |04| |
| | |06|
|07| | |
| |10| |
| | |11|
|03| |xx|
| |05|xx|
|06| |xx|
| |07|xx|
|08| |xx|
| |10|xx|
|11| |xx|
Bot #2 is the winner
With 5 bots:
|01|02|03|04|05|
|01| | | | |
| |04| | | |
| | |05| | |
| | | |07| |
| | | | |10|
|11| | | | |
|xx|01| | | |
|xx| |03| | |
|xx| | |06| |
|xx| | | |09|
|xx|10| | | |
|xx| |11| | |
|xx| |xx|02| |
|xx| |xx| |03|
|xx|05|xx| | |
|xx| |xx|07| |
|xx| |xx| |08|
|xx|10|xx| | |
|xx| |xx|11| |
|xx| |xx|xx|01|
|xx|03|xx|xx| |
|xx| |xx|xx|04|
|xx|07|xx|xx| |
|xx| |xx|xx|08|
|xx|10|xx|xx| |
|xx| |xx|xx|11|
Bot #2 is the winner
With 10 players:
|01|02|03|04|05|06|07|08|09|10|
|01| | | | | | | | | |
| |04| | | | | | | | |
| | |05| | | | | | | |
| | | |08| | | | | | |
| | | | |09| | | | | |
| | | | | |10| | | | |
| | | | | | |11| | | |
| | | | | | |xx|02| | |
| | | | | | |xx| |04| |
| | | | | | |xx| | |07|
|09| | | | | |xx| | | |
| |10| | | | |xx| | | |
| | |11| | | |xx| | | |
| | |xx|01| | |xx| | | |
| | |xx| |02| |xx| | | |
| | |xx| | |03|xx| | | |
| | |xx| | | |xx|04| | |
| | |xx| | | |xx| |07| |
| | |xx| | | |xx| | |08|
|09| |xx| | | |xx| | | |
| |10|xx| | | |xx| | | |
| | |xx|11| | |xx| | | |
| | |xx|xx|02| |xx| | | |
| | |xx|xx| |03|xx| | | |
| | |xx|xx| | |xx|05| | |
| | |xx|xx| | |xx| |08| |
| | |xx|xx| | |xx| | |09|
|10| |xx|xx| | |xx| | | |
| |11|xx|xx| | |xx| | | |
| |xx|xx|xx|03| |xx| | | |
| |xx|xx|xx| |05|xx| | | |
| |xx|xx|xx| | |xx|08| | |
| |xx|xx|xx| | |xx| |10| |
| |xx|xx|xx| | |xx| | |11|
|01|xx|xx|xx| | |xx| | |xx|
| |xx|xx|xx|03| |xx| | |xx|
| |xx|xx|xx| |06|xx| | |xx|
| |xx|xx|xx| | |xx|08| |xx|
| |xx|xx|xx| | |xx| |09|xx|
|10|xx|xx|xx| | |xx| | |xx|
| |xx|xx|xx|11| |xx| | |xx|
| |xx|xx|xx|xx|03|xx| | |xx|
| |xx|xx|xx|xx| |xx|05| |xx|
| |xx|xx|xx|xx| |xx| |06|xx|
|08|xx|xx|xx|xx| |xx| | |xx|
| |xx|xx|xx|xx|09|xx| | |xx|
| |xx|xx|xx|xx| |xx|10| |xx|
| |xx|xx|xx|xx| |xx| |11|xx|
|02|xx|xx|xx|xx| |xx| |xx|xx|
| |xx|xx|xx|xx|05|xx| |xx|xx|
| |xx|xx|xx|xx| |xx|08|xx|xx|
|09|xx|xx|xx|xx| |xx| |xx|xx|
| |xx|xx|xx|xx|10|xx| |xx|xx|
| |xx|xx|xx|xx| |xx|11|xx|xx|
|01|xx|xx|xx|xx| |xx|xx|xx|xx|
| |xx|xx|xx|xx|04|xx|xx|xx|xx|
|07|xx|xx|xx|xx| |xx|xx|xx|xx|
| |xx|xx|xx|xx|10|xx|xx|xx|xx|
|11|xx|xx|xx|xx| |xx|xx|xx|xx|
Bot #6 is the winner