Contents

Cmput 455 Assignment 3

Due Nov 15, 11:55pm. Submit via eClass submission link on the main eClass course page.
Late submission (with 20% deduction) Nov 17, 11:55pm. Submit via separate eClass link for late submissions.

In this assignment, you develop and then improve a simulation-based player for the game of Gomoku. You add your improvements to the same starter code as for Assignment 2, which is a random Gomoku player.

Setup

  1. First, as in previous assignments, make sure you have your Python 3, NumPy and GoGui set up. You can review the procedures under Lecture 3 activities.
  2. Download assignment3.tgz and expand it. The directory assignment3 contains:
  3. Modify/add code in directory assignment3 only to implement your solution.
  4. For more information about concepts related to this assignment, see the following resources:

Part 1: Simulation-based Gomoku Player

Create a new file Gomoku3.py inside your assignment3 folder. Then implement a simulation-based "Flat Monte Carlo" player there. The default player, when run without any of the behavior-changing options below, should work as follows:

Part 2: Rule-based simulations

In rule-based simulations, we restrict the number of moves that we choose from during simulation. For example, in class we looked at the MoGo patterns and some tactical rules in the case of Go. In this part of the assignment, you implement a rulebased policy with the rules below for your Gomoku3 player. The policy recognizes five types of moves. Go through the rules in order from most urgent (higher up in the list) to least urgent. For each rule, create the list of moves that match the rule. If the rule generates one or more moves, then randomly pick one of these moves. If the rule leads to an empty list of moves (no moves match), then proceed to the next rule.

  1. Win: if you can win directly, in one move, then only consider one of the winning moves.
  2. BlockWin: if the opponent can win directly, then only play a move that blocks the win. For example, OO.OO can be blocked by a move OOXOO.

    Even if you cannot prevent the win, as in the case .OOOO., or when there is more than one open four on the board, you should generate a blocking move.

  3. OpenFour: if you have a move that creates an open four position of type .XXXX., then play it.

    Examples of this scenario are: .X.XX. and .XXX..

  4. BlockOpenFour: play a move that prevents the opponent from getting an open four. For example, the situation ..OOO.. can be blocked by moves .XOOO.. or ..OOOX.. Note that all moves that block an open four should be generated. Specifically, in patterns .OO.O. and X.OOO.. all three moves work to block the open four and should be generated.
  5. Random: if none of the previous cases applies, then generate a move uniformly at random, as in part 1.

All the examples above are given for X to play. However, your code should work for both players.

In Gomoku, there are more rules that make sense. For example, it is often a good move to make a threat that can be blocked, such as playing one of the empty points in ..XXXO However, in this assignment you do not implement such other rules.

GTP Commands

The Usual Warnings - Read them All

Pre-submission Test and Submission

Follow the same general steps as in assignment 1 to create your presubmission.log file and your submission, but (of course) using your assignment3 directory, assignment3.tgz as file name, and assignment3-public-tests.gtp as test. Remember to include your new presubmission.log and readme.txt.

Hints and Details - Read them All

Marking

There will again be 5 marks for this assignment.


Created: Feb 25, 2019 Last modified: Aug 6, 2021

Martin Müller and Ting-Han Wei