diff options
-rw-r--r-- | dotsandboxes/GameState.py (renamed from python/GameState.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/agent_AB.py (renamed from python/agent_AB.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/agent_MCTS.py (renamed from python/agent_MCTS.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/agent_random.py (renamed from python/dotsandboxes/dotsandboxesagent.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/algorithms/MCTS.py (renamed from python/MCTS.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/algorithms/alphaBeta.py (renamed from python/alphaBeta.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/agents/algorithms/ann.py (renamed from python/ann.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/board.py (renamed from python/board.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/dataStructures.py (renamed from python/dataStructures.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/server.py (renamed from python/dotsandboxes/dotsandboxesserver.py) | 2 | ||||
-rw-r--r-- | dotsandboxes/test/cli_compete.py (renamed from python/dotsandboxes/dotsandboxescompete.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/test/evaluate.py (renamed from python/evaluate.py) | 0 | ||||
-rw-r--r-- | dotsandboxes/web/dotsandboxes.css (renamed from python/dotsandboxes/static/dotsandboxes.css) | 0 | ||||
-rw-r--r-- | dotsandboxes/web/dotsandboxes.html (renamed from python/dotsandboxes/static/dotsandboxes.html) | 0 | ||||
-rw-r--r-- | dotsandboxes/web/dotsandboxes.js (renamed from python/dotsandboxes/static/dotsandboxes.js) | 0 | ||||
-rw-r--r-- | python/dotsandboxes/README.md | 134 | ||||
-rwxr-xr-x | python/dotsandboxes/dotsandboxesagent | 5 | ||||
-rw-r--r-- | requirements.txt (renamed from python/dotsandboxes/requirements.txt) | 1 | ||||
-rwxr-xr-x | start.sh (renamed from python/start.sh) | 0 |
19 files changed, 2 insertions, 140 deletions
diff --git a/python/GameState.py b/dotsandboxes/GameState.py index eed8f36..eed8f36 100644 --- a/python/GameState.py +++ b/dotsandboxes/GameState.py diff --git a/python/agent_AB.py b/dotsandboxes/agents/agent_AB.py index 5564f11..5564f11 100644 --- a/python/agent_AB.py +++ b/dotsandboxes/agents/agent_AB.py diff --git a/python/agent_MCTS.py b/dotsandboxes/agents/agent_MCTS.py index b60f5ec..b60f5ec 100644 --- a/python/agent_MCTS.py +++ b/dotsandboxes/agents/agent_MCTS.py diff --git a/python/dotsandboxes/dotsandboxesagent.py b/dotsandboxes/agents/agent_random.py index abf677b..abf677b 100644 --- a/python/dotsandboxes/dotsandboxesagent.py +++ b/dotsandboxes/agents/agent_random.py diff --git a/python/MCTS.py b/dotsandboxes/agents/algorithms/MCTS.py index 6c71ba9..6c71ba9 100644 --- a/python/MCTS.py +++ b/dotsandboxes/agents/algorithms/MCTS.py diff --git a/python/alphaBeta.py b/dotsandboxes/agents/algorithms/alphaBeta.py index 8e041fe..8e041fe 100644 --- a/python/alphaBeta.py +++ b/dotsandboxes/agents/algorithms/alphaBeta.py diff --git a/python/ann.py b/dotsandboxes/agents/algorithms/ann.py index 05ae647..05ae647 100644 --- a/python/ann.py +++ b/dotsandboxes/agents/algorithms/ann.py diff --git a/python/board.py b/dotsandboxes/board.py index 36cfe8c..36cfe8c 100644 --- a/python/board.py +++ b/dotsandboxes/board.py diff --git a/python/dataStructures.py b/dotsandboxes/dataStructures.py index 1e972fc..1e972fc 100644 --- a/python/dataStructures.py +++ b/dotsandboxes/dataStructures.py diff --git a/python/dotsandboxes/dotsandboxesserver.py b/dotsandboxes/server.py index 1b66372..914ab45 100644 --- a/python/dotsandboxes/dotsandboxesserver.py +++ b/dotsandboxes/server.py @@ -23,7 +23,7 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): if self.path == "/": self.send_response(302) - self.send_header("Location", "static/dotsandboxes.html") + self.send_header("Location", "web/dotsandboxes.html") self.end_headers() return super().do_GET() diff --git a/python/dotsandboxes/dotsandboxescompete.py b/dotsandboxes/test/cli_compete.py index ee2aee8..ee2aee8 100644 --- a/python/dotsandboxes/dotsandboxescompete.py +++ b/dotsandboxes/test/cli_compete.py diff --git a/python/evaluate.py b/dotsandboxes/test/evaluate.py index fb60211..fb60211 100644 --- a/python/evaluate.py +++ b/dotsandboxes/test/evaluate.py diff --git a/python/dotsandboxes/static/dotsandboxes.css b/dotsandboxes/web/dotsandboxes.css index 71b1d3b..71b1d3b 100644 --- a/python/dotsandboxes/static/dotsandboxes.css +++ b/dotsandboxes/web/dotsandboxes.css diff --git a/python/dotsandboxes/static/dotsandboxes.html b/dotsandboxes/web/dotsandboxes.html index 4e97508..4e97508 100644 --- a/python/dotsandboxes/static/dotsandboxes.html +++ b/dotsandboxes/web/dotsandboxes.html diff --git a/python/dotsandboxes/static/dotsandboxes.js b/dotsandboxes/web/dotsandboxes.js index 11e9447..11e9447 100644 --- a/python/dotsandboxes/static/dotsandboxes.js +++ b/dotsandboxes/web/dotsandboxes.js diff --git a/python/dotsandboxes/README.md b/python/dotsandboxes/README.md deleted file mode 100644 index e3f844c..0000000 --- a/python/dotsandboxes/README.md +++ /dev/null @@ -1,134 +0,0 @@ -Dots and Boxes application -========================== - -Live demo: https://people.cs.kuleuven.be/wannes.meert/dotsandboxes/play - -![Screenshot of Dots and Boxes](https://people.cs.kuleuven.be/wannes.meert/dotsandboxes/screenshot.png?v=2) - -This setup is part of the course "Machine Learning: Project" (KU Leuven, -Faculty of engineering, Department of Computer Science, -[DTAI research group](https://dtai.cs.kuleuven.be)). - - -Installation ------------- - -The example agent is designed for Python 3.6 and requires the -[websockets](https://websockets.readthedocs.io) package. Dependencies can be -installed using pip: - - $ pip install -r requirements.txt - - -Start the game GUI ------------------- - -This program shows a web-based GUI to play the Dots and Boxes -game. This supports human-human, agent-human and agent-agent combinations. -It is a simple Javascript based application that runs entirely in the browser. -You can start it by opening the file `static/dotsandboxes.html` in a browser. -Or alternatively, you can start the app using the included simple server: - - $ ./dotsandboxesserver.py 8080 - -The game can then be played by directing your browser to http://127.0.0.1:8080. - - -Start the agent client ----------------------- - -This is the program that runs a game-playing agent. This application listens -to [websocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) -requests that communicate game information and sends back the next action it -wants to play. - -Starting the agent client is done using the following command: - - $ ./dotsandboxesagent <port> - -This starts a websocket on the given port that can receveive JSON messages. - -The JSON messages given below should be handled by your agent. -Take into account the maximal time allowed to reply. - -### Initiate the game - -Both players get a message that a new game has started: - - { - "type": "start", - "player": 1, - "timelimit", 0.5, - "grid": [5, 5], - "game": "123456" - } - -where `player` is the number assigned to this agent, `timelimit` is the -time in seconds in which you need to send your action back to the server, -and `grid` is the grid size in rows and columns. - -If you are player 1, reply with the first action you want to perform: - - { - "type": "action", - "location": [1, 1], - "orientation": "v" - } - -The field `location` is expressed as row and column (zero-based numbering) and -`orientation` is either "v" (vertical) or "h" (horizontal). - - -### Action in the game - -When an action is played, the message sent to both players is: - - { - "type": "action", - "game": "123456", - "player": 1, - "nextplayer": 2, - "score": [0, 0], - "location": [1, 1], - "orientation": "v" - } - - -If it is your turn you should answer with a message that states your next -move: - - { - "type": "action", - "location": [1, 1], - "orientation": "v" - } - - -### Game end - -When the game ends after an action, the message is slightly altered: - - { - "type": "end", - "game": "123456", - "player": 1, - "nextplayer": 0, - "score": [3, 1], - "location": [1, 1], - "orientation": "v", - "winner": 1 - } - -The `type` field becomes `end` and a new field `winner` is set to the player -that has won the game. - - -Contact information -------------------- - -- Wannes Meert, https://people.cs.kuleuven.be/wannes.meert -- Hendrik Blockeel, https://people.cs.kuleuven.be/hendrik.blockeel -- Arne De Brabandere, https://people.cs.kuleuven.be/arne.debrabandere -- Sebastijan Dumančić, https://people.cs.kuleuven.be/sebastijan.dumancic -- Pieter Robberechts, https://people.cs.kuleuven.be/pieter.robberechts - diff --git a/python/dotsandboxes/dotsandboxesagent b/python/dotsandboxes/dotsandboxesagent deleted file mode 100755 index eecf719..0000000 --- a/python/dotsandboxes/dotsandboxesagent +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# It is not necessary to use a shell script for this. Dropping the .py -# extension and including the correct shebang is also correct. -python3 $(dirname "$0")/dotsandboxesagent.py $@ - diff --git a/python/dotsandboxes/requirements.txt b/requirements.txt index 14774b4..af05743 100644 --- a/python/dotsandboxes/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ websockets +numpy
\ No newline at end of file diff --git a/python/start.sh b/start.sh index 455944d..455944d 100755 --- a/python/start.sh +++ b/start.sh |