Skip to content

Commit

Permalink
Merge be5be17 into 1e55c3e
Browse files Browse the repository at this point in the history
  • Loading branch information
sethtroisi committed May 20, 2018
2 parents 1e55c3e + be5be17 commit 9634398
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -6,3 +6,4 @@

- Richard Lange
- Brian Lee
- Google LLC
8 changes: 8 additions & 0 deletions gtp.py
Expand Up @@ -225,6 +225,9 @@ def cmd_genmove(self, arguments):
else:
raise ValueError("unknown player: {}".format(arguments))

def cmd_final_score(self, arguments):
return self._game.get_score()


class MinimalGame(object):

Expand Down Expand Up @@ -262,3 +265,8 @@ def set_komi(self, k):
def get_move(self, color):
# pass every time. At least it's legal
return (0, 0)

def get_score(self):
# Valid return types are the SGF RE options. For example:
# W+0.5, B+R, B+T, Draw, Void, B+Forfeit, ?
return "?"
8 changes: 6 additions & 2 deletions test.py
Expand Up @@ -98,8 +98,9 @@ def test_admin_commands(self):
response = self.engine.send("6 list_commands\n")
self.assertEqual(
response,
"=6 boardsize\nclear_board\ngenmove\nknown_command\nkomi\n"
"list_commands\nname\nplay\nprotocol_version\nquit\nversion\n\n")
"=6 boardsize\nclear_board\nfinal_score\ngenmove\nknown_command\n"
"komi\nlist_commands\nname\nplay\nprotocol_version\nquit\n"
"version\n\n")

response = self.engine.send("99 quit\n")
self.assertEqual(response, "=99\n\n")
Expand Down Expand Up @@ -140,6 +141,9 @@ def test_core_play(self):
response = self.engine.send("17 genmove orange")
self.assertEqual(response, "?17 unknown player: orange\n\n")

response = self.engine.send("18 final_score")
self.assertEqual(response, "=18 ?\n\n")


if __name__ == "__main__":
unittest.main()

0 comments on commit 9634398

Please sign in to comment.