- At least 4 of your chips are connected in any one direction (horizontal, vertical, or diagonal).
A higher resolution is required to access the IDE
- 76
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
The Goal
Rules
Each player takes turns to drop chips into one of the columns.
The game works as follows:
- A player gets full state of the board as input.
- The player chooses a column to drop their chip in (outputs a single integer in range [0,8])
- The chip falls in that column of the board and settles in the bottom most empty cell.
There are 9 columns, indices are [0,8].
0 => left most column.
8 => right most column.
The STEAL move for the second player: (optional)
- The second player can play "STEAL" for their first action.
- This action does not place a new chip on the board but will convert the opponent's one and only existing chip into the second player's own chip.
- This action is available only to the second player, and only for their first action.
- An example is illustrated below
First player placed a chip in
the middle column.Second Player used "STEAL"
and converted the existing chip. - The second player can output either the word
STEAL or the integer-2 for this action.
- Your program does not provide a command in the allotted time or one of the commands is unrecognized.
- It chooses a column which is already filled, or, not in range i.e. not in [0,8].
🐞 Debugging tips
- Append text with a preceding space after your output and that text will appear below your player's name. Longer messages will be shown in lines of 15 characters.
- Press the gear icon on the viewer to access extra display options.
- Use the keyboard to control the action: space to play/pause, arrows to step 1 frame at a time.
Game Input
One line: 2 integers myId, oppId.
One of them will be
First Line: integer turnIndex. Index of the current turn. As the game progresses,
first player receives
Next
Next line: integer numValidActions: the number of valid actions available to your bot (equal to the number of unfilled columns in the board, plus one for "STEAL" if it is second turn of the game).
Next numValidActions lines: 1 integer action: one valid action (index of an unfilled column, or, -2 for STEAL in the second turn of the game).
Next line: integer oppPreviousAction:
the column index chosen by the opponent in the previous turn (first player gets
Response time per turn ≤
Response time for the first turn <=
The source code of this game is available on GitHub.
A higher resolution is required to access the IDE