- You have more points at the end of the game or
- You scored the same number of points, but you occupied more total cells.
Game of Life or Death
17 CodinGamers in the Game of Life or Death arena
Approved by darkhorse64 Anonymous__7 JustForFun123
A higher resolution is required to access the IDE
- 6
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
The Goal
The game is played on a rectangular grid of cells that can either be alive or dead (
- Any live cell with fewer than two live neighbors dies, as if by underpopulation.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overpopulation.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
In addition to the above rules:
- Live cells can belong to either
Player 1 orPlayer 2 . - The opponent's live cells are considered dead when calculating the next state for each player.
- If both players try to activate the same cell, that cell remains dead instead.
Finally, there are a set of cells in the middle of the grid called goalCells. For each turn that a goalCell is alive, the cell's owner scores one point. The player with the greatest number of points after 200 turns wins!
Rules
You control a single column on one side of the grid. Each turn, your bot will output a string of space-separated binary digits (
These digits update the state of either the left or right-most columns of cells in the grid for the next turn.
- If you are
Player 1 , your bot's output will be applied to the left-most column (top to bottom) on the viewport grid. - If you are
Player 2 , your bot's output will be flipped and applied to the right-most column (bottom to top) on the viewport grid.
NOTE: From your code's perspective, you will always control the left side of the grid regardless of whether you are
The displayed board state will be rotated
A visual representation of the grid and how the bot's output is used to update the grid.

The game grid works as follows:
- Cells you occupy have a value of
1 . - Cells your opponent occupies have a value of
-1 . - Cells you occupy interact with each other from one turn to the next according to the rules of Conway's Game of Life
- Cells you occupy do not interact with cells occupied by the opponent (they are treated as if they are
0 ) - If both you and your opponent would occupy the same cell on a given turn, the effects cancel each other out and the cell remains unoccupied (
0 ). - The grid wraps around the top and bottom edges, so cells in the top row are neighbors with cells in the bottom row.
The specific coordinates of goalCells are provided as input on the first turn of the game.
You score one point for each goalCell you occupy at the end of each turn.
You win if, at the end of 200 turns, you have more points than your opponent. If tied, the player with the most cells occupied wins.
MANA
You start the game with
Each cell you activate costs
At the end of each turn, you will receive
Any unused mana points are carried over to the next turn up to a maximum of
Hint:
Spaceships are a good way to move around the grid! Try to find a way to build one.
- Unknown command (anything that is not a space-separated line of
0 or1 with exactly the same number of digits as the number of rows in the grid) - Your opponent has more points at the end of the game or they have the same number of points and have more total cells occupied.
Game Input
Line 1: rowCount, an integer representing the height of the grid.
Line 2: columnCount, an integer representing the width of the grid.
Line 3: maxMana, an integer representing the maximum amount of mana available on any given turn.
Line 4: goalCellCount, an integer representing the number of goalCells present on the grid.
Next goalCellCount lines: Space-delimited
Line 1: mana, an integer representing the amount of mana available to spend this turn. This is how many
Line 2: opponentMana, an integer representing the amount of mana the opponent has available to spend this turn. This is how many
rowCount lines: The current state of one row of the game grid. A space-delimited string of integers between
1 represents a cell you occupy-1 represents a cell occupied by your opponent0 represents an unoccupied cell
The Origin Story
What if it wasn't?
A higher resolution is required to access the IDE