Let's Connect! (Easy version)

Exclusive Normal 3 BasicsGame Theory Citadel

This is the easy version of Connect4Bot. The only difference between this and the hard version is the strength of play required to defeat the grader. Solving one version does not guarantee solving the other.

This is an interactive problem.

Implement the class Connect4Bot, which plays the game Connect 4 with the goal of winning. Connect 4 (or Connect Four) is a classic two-player strategy game where players drop colored discs into a vertical grid, aiming to be the first to get four of their own color in a row (horizontally, vertically, or diagonally) before their opponent does.

For this problem, a heuristic approach should suffice — however, a simple solution that only looks one move ahead may be insufficient. Your bot should ideally be able to set up multi-move attacks such as creating or preventing positions where the opponent cannot block all threats.

The interactor is adaptive, meaning the judge will adjust its strategy in response to your bot's behavior.


Methods

move(board)

  • board is the current state of the game board as a subscriptable 2-dimensional container. This board is guaranteed to be 7×77\times 7 in size.
  • board is accessible with as a custom type Board which is guaranteed to be subscriptable. You should be using this type Board rather than a default container like std::vector.
  • board's columns are labeled 0-6 from left to right, and rows are labeled 0-6 from bottom to top.
  • Each board[i][j] has an integer value. This value is either 0, 1, or 2.
    • 0 indicates an empty square at row i and column j.
    • 1 indicates your bot's piece at row i and column j.
    • 2 indicates the judge's bot's piece at row i and column j.
  • The function should return an integer between 00 and 66, inclusive, indicating the column in which your bot chooses to drop its disc.

Notes

  • You do not need to implement any input/output parsing.

  • Your submission will be evaluated against our reference bot. It plays at approximately the same strength level expected from your Connect 4 bot, but is intentionally slightly nerfed.

Accepted 3/3
Acceptance 100%
Loading editor...
Sample Input:
RUNNING TESTS... EVALUATING YOUR BOT IN A BEST OF 5
Expected Output: