Commit 46904944 authored by Constantin Berhard's avatar Constantin Berhard

add player to field

parent 2216d58b
......@@ -2,6 +2,7 @@ from player import Player
import selectors
import socket
import labyrinth
import random
class Game:
def __init__(self, labyrinthFileName, port=1234):
......@@ -18,8 +19,9 @@ class Game:
def accept(self, sock, mask):
assert sock == self.sock
conn, addr = sock.accept() # Should be ready
tile = random.choice(self.labyrinth.getFreeTiles())
player = Player(self, conn)
self.labyrinth.createThing(player,tile)
self.players.append(player)
self.sel.register(conn, selectors.EVENT_READ, player.read)
......
......@@ -7,7 +7,7 @@ sayVerbs = ['say', 'talk', 'scream']
class Player(Thing):
def __init__(self, game, conn):
super().__init__(self)
super().__init__()
self.buffer = b""
self.game = game
self.conn = conn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment