Cookie settings

We use analytics cookies to improve the service. Learn more

ALPHANO Logo

Betris (Large)

Top PlayerSubmissionsParticipants

Problem

Betris is a strategic game where players compete in betting to acquire polyomino blocks on a 5×55 \times 5 board and efficiently place the acquired blocks to fill the board.

1. Board and Components

Each player starts the game with one empty board and 2424 chips to be used for betting.

fig1

The board consists of 77 rows and 77 columns. Rows are numbered 11 to 77 from top to bottom, and columns are numbered 11 to 77 from left to right. A cell at the xx-th row and yy-th column is denoted as (x,y)(x, y). Chips can be used during the betting phase later in the game.

fig2 fig3

2121 types of polyomino blocks are used in the game. The shapes and names of each block are shown above.

2. Game Progression

The game proceeds for a total of 1212 rounds. Each round is divided into a Betting Phase and a Placement Phase.

Phase 1: Betting Phase

  • The judge selects one of the 2121 types of blocks with equal probability and designates it as AA. Then, it selects one of the remaining 2020 types of blocks with equal probability and designates it as BB.
  • Each player submits their choice of block (either AA or BB) and the number of chips they wish to bet to the judge. The number of chips bet must be between 00 and 55 inclusive, and cannot exceed the number of chips the player currently possesses.
  • Once both players have decided on their block and chip amount, the judge determines the success of the bet according to the following rules:
    • If the two players chose different blocks, both players succeed in their bets.
    • If the two players chose the same block and the number of chips bet is different, the player who bet more chips succeeds.
    • If the two players chose the same block and the number of chips bet is the same, the judge randomly selects one player to succeed.
  • The player who succeeds in the bet acquires their chosen block and pays the number of chips they bet.
  • The player who fails in the bet acquires the block they did not choose and does not pay any chips.

Phase 2: Placement Phase

  • Each player can rotate their acquired block clockwise by 9090^\circ as many times as they want.
  • Each player can flip their acquired block horizontally/vertically as many times as they want.
  • Afterward, the player can either place the block on the board or choose to PASS.
  • If a player chooses to place the block, it must be placed within the board boundaries and on cells that are not already occupied by other blocks.
  • If a player decides that it is disadvantageous to place a block even if there is space, they may select PASS.

3. Scoring

After all rounds are completed, each player's score is calculated as follows:

  • 11 point is awarded for each cell occupied by a block on the board.
  • 11 point is awarded for each cell within the largest square that can be formed using only the filled cells on the board.
  • 0.50.5 points are awarded for each remaining chip.

For example, in the following case, the player's score is 42+25+3×0.5=68.542 + 25 + 3 \times 0.5 = 68.5 points.

fig4

The final winner is the player with the higher score. If the scores are equal, the game ends in a draw.

Input

The judge program communicates with the player using single-line text commands as follows:

Command Judge → Player (Input) Player → Judge (Output) Time Limit (ms) Description
READY READY OK 3000 Signals the start of the game.
PHASE1 PHASE1 A B my_time opp_time BET C x my_time Informs the block pair (A,B)(A, B) selected by the judge and the remaining time for both players. Output your chosen block and the number of chips to bet.
PHASE2 PHASE2 C my_chip opp_chip my_time opp_time PLACE k x1 y1 ... xk yk my_time After the betting phase, informs the acquired block, remaining chips, and time for both players. If placing a block, output the number of cells kk and their coordinates. Output PLACE 0 to PASS.
OPP OPP k x1 y1 ... xk yk - - After the placement phase, informs the move made by the opponent.
FINISH FINISH - - Signals the end of the game. The player must terminate normally without further output.
  • The READY command is given once before the 11st round starts, and the FINISH command is given once after the 1212th round ends.
  • The PHASE1, PHASE2, and OPP commands are given once per round in order.

For the PHASE1 command:

  • Input A, B will be one of: I1, I2, I3, L3, I4, L4, S4, T4, O4, I5, L5, F5, N5, P5, T5, U5, V5, W5, X5, Y5, Z5.
  • Input A and B are always different.
  • Output C must be either A or B.
  • Output x must be an integer between 00 and 55 inclusive and cannot exceed your current chip count.

For the PHASE2 command:

  • Input C is the block you acquired (one of the A or B from the previous PHASE1).
  • Output k x1 y1 ... xk yk must be 2k+12k + 1 space-separated integers.
  • If k>0k > 0, kk must equal the number of cells in block C.
  • If k>0k > 0, the following 2k2k integers represent the coordinates (x1,y1),,(xk,yk)(x_1, y_1), \cdots, (x_k, y_k) of the cells where the block is placed, which must be valid according to the rules.

General I/O Rules:

  • my_chip, opp_chip, my_time, opp_time, and time are all integers.
  • All times are in milliseconds.
  • After every output, you must print a newline character and flush the buffer.
  • Failure to output within the time limit results in a Time Limit Exceeded (TLE) verdict.
  • Outputting an invalid format results in a Runtime Error (RE) verdict.

Example

P1 Input P1 Output P2 Input P2 Output
READY READY
OK OK
PHASE1 I2 F5 10000 10000 PHASE1 I2 F5 10000 10000
BET F5 4 BET F5 4
PHASE2 F5 20 24 9999 9999 PHASE2 I2 24 20 9999 9999
PLACE 5 1 1 1 2 2 2 2 3 3 2 PLACE 2 1 1 1 2
OPP 2 1 1 1 2 OPP 5 1 1 1 2 2 2 2 3 3 2
PHASE1 P5 L3 9998 9998 PHASE1 P5 L3 9998 9998
BET P5 5 BET L3 2
PHASE2 P5 15 22 9997 9997 PHASE2 L3 22 15 9997 9997
PLACE 5 1 3 1 4 1 5 2 4 2 5 PLACE 3 1 3 1 4 2 3
OPP 3 1 3 1 4 2 3 OPP 5 1 3 1 4 1 5 2 4 2 5
\cdots \cdots \cdots \cdots
FINISH FINISH

Sample Code

Limit

  • Time: For the first PHASE1 command given to each player, my_time is 1000010\,000 ms.
  • Memory: 1024MB
  • Judging Environment: HELP > Judging Environment