Gomoku game (human vs. computer)

Since we have completed the Gomoku human vs. human implementation, let's discuss the human vs. computer approach. However, before we head into the implementation details, we should have a look at the requirements of this approach:

  1. The number of players is restricted to two; this is done to ensure that we have one human and one computer player to simplify the algorithm.

  2. The computer can randomly place its symbol in any valid board position.

  3. The computer should perform its turn by keeping in mind the following two points:

    1. The computer must prioritize placing its symbol where it has a winning chance.

    2. If that's not the case, then the computer must prioritize placing its symbol where it can block the opponent's win.


Your implementation

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy