[DidaOJ] 80 - KACA's Gomoku

Problem Description

Loading...

Problem Analysis

Unlike the first-move advantage in many Game Theory problems, the two-stone game described by the rules actually has each player creating obstacles for themselves with every move.

As the obstacles you create pile up, you will eventually be unable to make any move.

Because of the board’s symmetry, the side that creates obstacles first will ultimately find it hard to win, since under ideal play the opponent can always block them first.

For a 1*3 board: the first player gains nothing by playing the middle, since the second player can pick either side and leave the first player with no legal move. Even if the first player plays on one side, the second player can mirror the move and block them.

The 1*4 board is similar: no matter how the first player moves, the second player only needs to mirror it, and eventually the first player will have no move left.

Analyzing all cases shows that as long as the board has more than one cell, the first player cannot win no matter what.

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <iostream>

int main()
{
    int n, m;
    while (std::cin >> n >> m)
    {
        std::cout << (n == 1 && m == 1 ? "Bwin" : "Ewin") << std::endl;
    }
    return 0;
}

Problem link: 【DidaOJ】[80]KACA’s Two-Stone Game

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...