Exemple #1
0
    '8': 32208,
    '9': 32209,
    'alex': 32217,
    'listen': 201,
    'sendingchoice': 32218
}
numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
#numbers = [0]

drawboard = ['2', '5', '6', '10', '11']

# Main loop
if __name__ == '__main__':
    # Creating objects
    cap = cv2.VideoCapture(1)
    game = GameChecker(capture=cap, watch=False)
    while 1:

        PLS = ModbusClient(ip='158.38.140.63')

        while PLS.isConnected():
            try:
                # Listens for when we want to start the program
                start = PLS.readInt(address=207, size=1)
                start = PLS.readInt(address=207, size=1)
                print(str(start))

                while str(start) == "[1]":
                    # Give system time to respond
                    time.sleep(0)
import cv2
import time

array = [1, 2, 3, 4, 5, 6, 7, 8, 9]

numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9']

drawboard = ['2', '5', '6', '10', '11']

# Main loop
if __name__ == '__main__':
    UR31 = ModbusClient(ip='158.38.140.249')
    UR32 = ModbusClient(ip='158.38.140.250')
    cap = cv2.VideoCapture(1)

    game = GameChecker(capture=cap, watch=True)

    players = [UR31, UR32]
    playerstest = ["player1", "player2"]

    startplayer = random.randint(0, 1)  # Decides who starts
    turn = startplayer

    while UR31.isConnected() and UR32.isConnected():
        clean = game.cleanBoard()

        if not clean:
            UR32.sendInt(address=143, value=0)
            time.sleep(1)
            UR32.sendInt(address=143, value=69)
            time.sleep(1)
Exemple #3
0
game_state = ["-", "-", "-", "-", "-", "-", "-", "-", "-"]

# Create a list of all possible win combinations
"""                     1          2          3          4          5          6          7          8  """
win_combinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [6, 3, 0], [7, 4, 1],
                    [8, 5, 2], [6, 4, 2], [8, 4, 0]]

# Main loop
if __name__ == '__main__':

    # Creating the client and camera capture.
    #client = ModbusClient(ip='158.38.140.250')
    cap = cv2.VideoCapture(1)
    # TODO -  SCALE DOWN THE CAPTURE

    game = GameChecker(capture=cap, watch=True)

    print("Objects created.")
    print("Client connecting...")
    while 1:
        """This is used for testing when I cannot use our
        robot for testing when I am away from the LAB"""
        string = str(input("enter below\n"))
        print(string)
        """Just a test"""
        if string == "s":
            print("penis")
        if string == "check":
            print(str(game.getGamestateXO()))

        if string == "clean":
# Create a list of all possible win combinations
"""                     1          2          3          4          5          6          7          8  """
win_combinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [6, 3, 0], [7, 4, 1],
                    [8, 5, 2], [6, 4, 2], [8, 4, 0]]

# Main loop
if __name__ == '__main__':

    # Creating the client and camera capture.
    client = ModbusClient(ip='158.38.140.250')
    PLS = ModbusClient(ip='158.38.140.63')
    cap = cv2.VideoCapture(1)
    # TODO -  SCALE DOWN THE CAPTURE

    game = GameChecker(capture=cap, watch=False)

    print("Objects created.")
    print("Client connecting...")
    while client.isConnected():
        try:
            """This is used for testing when I cannot use our
            robot for testing when I am away from the LAB"""
            string = str(input("enter below\n"))
            print(string)
            """Just a test lmao"""
            if string == "lmao":
                print("epiclmao")

            if string == "test123":
                while 1:
from gamechecker import GameChecker
import cv2

cap = cv2.VideoCapture(0)

game = GameChecker(capture=cap, watch=False)

old = game.getGamestateXO()
print(old)

new = game.getGamestate12()
print(str(new))
Exemple #6
0
""""      1  2  3  4  5  6  7  8  9"""
from gamechecker import GameChecker
import cv2
import numpy

cap = cv2.VideoCapture(1)
game = GameChecker(capture=cap, watch=False)

fields = game.getGamestate12()

index = 0
left = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(fields)
for element in fields:
    print(left)
    if int(element) != 0:
        left.pop(index)
    else:
        index += 1

if str(numpy.array(left)) == "[]":
    left = 0

print(left)