Beispiel #1
0
def main():

    CardSet.loadCardSet("CardSet")
    playerOne = Player("koala", CardSet.listCard)
    playerTwo = Player("panda", CardSet.listCard)
    print(sys.version)
    i = 1
    winner = None
    while winner == None :
        if i % 2 == 0 :
            winner = Field.playTurn(playerOne, playerTwo)
        else :
            winner = Field.playTurn(playerTwo, playerOne)
        i += 1
    playerOne.toString()
    playerTwo.toString()
    print("Vainqueur : ", winner.name)
Beispiel #2
0
def main():
##
##    connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
##    connection.bind(("", 12800))
##    connection.listen(5)
##    connectionClient, infosConnection = connection.accept()
##    listCard = CardSet.loadCardSet("C:\\Users\\MKSJ\\Documents\\GitHub\\Servant\\Exo 2\\cardSet")
##    playerOne = Player("panda", listCard)
##    print("connection faite")
##    msgClient = b""
##    while msgClient != b"fin":
##        msgClient = connectionClient.recv(1024)
##        # L'instruction ci-dessous peut lever une exception si le message
##        # Réceptionné comporte des accents
##        print(msgClient.decode())
##        msgServer = input(">").encode()
##        connectionClient.send(msgServer)


    connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    connection.bind(("", 12800))
    connection.listen(5)
    connectionClient, infosConnection = connection.accept()
    print("connection faite")
    listCard = CardSet.loadCardSet("/Users/pascal/Desktop/Servant/cardSet")
    playerOne = Player("panda", listCard)
    i = 0
    winner = None
    while winner == None :
        if i % 2 == 0 :
            winner = youPlay(playerOne, connectionClient)
        else :
            winner =  FieldNetwork.playTrun(playerTwo, playerOne, connectionClient)
        i += 1
    playerOne.toString()
    playerTwo.toString()
    print("Vainqueur : ", winner.name)

    connectionClient.close()
    connection.close()