From c3f1ac7d13f9e041c0583b3e7489fc1d01249091 Mon Sep 17 00:00:00 2001 From: Sanders Lin <45224617+SandersLin@users.noreply.github.com> Date: Mon, 8 Jul 2019 18:54:54 +0800 Subject: [PATCH 1/2] update games.py connect 4 display method original code displays board sideways. Fixed display method to print board bottom down --- games.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games.py b/games.py index 6aded01d5..571ceea52 100644 --- a/games.py +++ b/games.py @@ -417,7 +417,7 @@ def __init__(self, h=7, v=6, k=4): def actions(self, state): return [(x, y) for (x, y) in state.moves - if y == 1 or (x, y - 1) in state.board] + if x == self.h or (x + 1 , y ) in state.board] class Backgammon(StochasticGame): From 154b1dddeabad0a981aee97f3f5c12b52e10bf77 Mon Sep 17 00:00:00 2001 From: Sanders Lin <45224617+SandersLin@users.noreply.github.com> Date: Mon, 8 Jul 2019 18:57:35 +0800 Subject: [PATCH 2/2] update games.py add Gomoku game Trivially addition of Gomoku, thanks to flexible implementation of TicTacToe class --- games.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/games.py b/games.py index 571ceea52..ae922f0e5 100644 --- a/games.py +++ b/games.py @@ -419,6 +419,12 @@ def actions(self, state): return [(x, y) for (x, y) in state.moves if x == self.h or (x + 1 , y ) in state.board] +class Gomoku(TicTacToe): + """Also known as Five in a row.""" + + def __init__(self, h=15, v=16, k=5): + TicTacToe.__init__(self, h, v, k) + class Backgammon(StochasticGame): """A two player game where the goal of each player is to move all the