Skip to content

Commit

Permalink
Merge branch 'feat/IO-module' of https://github.com/corail-research/s…
Browse files Browse the repository at this point in the history
…eahorse into feat/IO-module
  • Loading branch information
RevenMyst committed Jul 28, 2023
2 parents 91ab420 + cd2cc28 commit 6b53731
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/abalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ async def play(self, current_state: GameState) -> Action:
def run_multiple_games():
for _ in range(1):

player2 = LocalPlayerProxy(RandomPlayerAbalone(piece_type="W"))
player1 = LocalPlayerProxy(AlphaPlayerAbalone(piece_type="B"))
player2 = RemotePlayerProxy(mimics=RandomPlayerAbalone,piece_type="W",name="marcel")
player1 = InteractivePlayerProxy(AlphaPlayerAbalone(piece_type="B"))

list_players = [player1, player2]
init_scores = {player1.get_id(): 0, player2.get_id(): 0}
Expand Down
2 changes: 1 addition & 1 deletion src/seahorse/examples/abalone/board_abalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ def from_json(cls, data) -> Serializable:
for x,y in d["env"].items():
# TODO eval is unsafe
del dd["env"][x]
dd["env"][eval(x)] = Piece.from_json(**json.dumps(y))
dd["env"][eval(x)] = Piece.from_json(json.dumps(y))
return cls(**dd)
2 changes: 1 addition & 1 deletion src/seahorse/execution/web/examples/abalone/auto/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(document).ready(function () {
var index = -1;
const logElement = document.getElementById("log");
var play = false;
const socket = io("ws://localhost:8080");
const socket = io("ws://10.200.37.65:16001");
socket.on("play", (...args) => {
json = JSON.parse(args[0]);
//console.log(json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(document).ready(function () {
var index = -1;
const logElement = document.getElementById("log");
var play = false;
const socket = io("ws://localhost:16001");
const socket = io("ws://10.200.37.65:16001");


socket.on("play", (...args) => {
Expand Down
4 changes: 2 additions & 2 deletions src/seahorse/game/io_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ def start(self, task: Callable[[None], None], listeners: list[EventSlave]) -> No
# Sets the runner up and starts the tcp server
self.event_loop.run_until_complete(self.runner.setup())
#print(self.port)
site = web.TCPSite(self.runner, "localhost", self.port)
site = web.TCPSite(self.runner, "10.200.37.65", self.port)
self.event_loop.run_until_complete(site.start())

async def stop():
for x in listeners:
await x.listen(master_address="http://localhost:"+str(self.port), keep_alive=False)
await x.listen(master_address="http://10.200.37.65:"+str(self.port), keep_alive=False)

# Waiting for all listeners
await self._wait_for_connexion()
Expand Down
2 changes: 1 addition & 1 deletion src/seahorse/game/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
self.log_file = log_file
self.players_iterator = cycle(players_iterator) if isinstance(players_iterator, list) else players_iterator
next(self.players_iterator)
self.emitter = EventMaster.get_instance(3,initial_game_state.__class__,port=port)
self.emitter = EventMaster.get_instance(4,initial_game_state.__class__,port=port)

async def step(self) -> GameState:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/standalone_abalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
from seahorse.examples.abalone.random_player_abalone import MyPlayer as RandomPlayerAbalone
from seahorse.player.proxies import LocalPlayerProxy

player1 = LocalPlayerProxy(RandomPlayerAbalone(piece_type="W", name= "bob"),masterless=True,gs=GameStateAbalone)
asyncio.new_event_loop().run_until_complete(player1.listen(keep_alive=True,master_address="http://localhost:16001"))
player1 = LocalPlayerProxy(RandomPlayerAbalone(piece_type="W", name= "marcel"),masterless=True,gs=GameStateAbalone)
asyncio.new_event_loop().run_until_complete(player1.listen(keep_alive=True,master_address="http://10.200.37.65:16001"))

0 comments on commit 6b53731

Please sign in to comment.