Example #1
0
        [1, 0, 0, 0, 0, 0, 1, 0],
        [0, 1, 0, 0, 0, 0, 0, 0],
        [0, 0, 1, 0, 0, 0, 0, 0],
        [0, 1, 0, 1, 0, 1, 0, 1],
        [1, 0, 1, 0, 1, 0, 1, 0]],
    [   [0, 1, 0, 0, 0, 1, 0, 1],
        [1, 0, 1, 0, 1, 0, 1, 0],
        [0, 0, 0, 0, 0, 1, 0, 0],
        [1, 0, 0, 0, 0, 0, 1, 0],
        [0, 1, 0, 0, 0, 0, 0, 0],
        [0, 0, 1, 0, 0, 0, 0, 0],
        [0, 1, 0, 1, 0, 1, 0, 1],
        [1, 0, 1, 0, 1, 0, 1, 0]],
    [   [0, 0, 0, 0, 0, 1, 0, 1],
        [1, 0, 0, 0, 1, 0, 1, 0],
        [0, 0, 0, 1, 0, 1, 0, 0],
        [1, 0, 0, 0, 0, 0, 1, 0],
        [0, 1, 0, 0, 0, 0, 0, 0],
        [0, 0, 1, 0, 0, 0, 0, 0],
        [0, 1, 0, 1, 0, 1, 0, 1],
        [1, 0, 1, 0, 1, 0, 1, 0]]
    ]
c = checkers.checkers()
print(c.getBoard())
for turn in Data:
    c.updateBoard(turn)
    c.check()
    print(c.getBoard())
    c.nextTurn()

Example #2
0
startState = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 3], [0, 0, 0, 0, -1, 0, 1, 0],
              [0, 0, 0, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]

# startState = [  [ 0, -1,  0, -1,  0, -1,  0,  0],
# [-1,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  1,  0,  0,  0,  0],
# [ 0,  0,  1,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0]    ]

# startState = [  [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0, -1,  0,  0,  0,  0,  0,  0],
# [ 0,  0,  0,  0,  0,  0,  0,  0],
# [ 0, -1,  0, -1,  0,  0,  0,  0],
# [ 0,  0,  1,  0,  0,  0,  0,  0]    ]

print("Starting ... ")

c = checkers(computerPlayer(3), computerPlayer(3), startState)
c.singleLoop()

# g = DataBuilder(startState)
# g.buildMoreData(500)
Example #3
0
        self.quit = False
        self.move = ""


pipE = pipe()

done = True


def makeTheMove(checkers):
    global done
    checkers.singleMove()
    done = True


c = checkers(humanPlayer(pipE), computerPlayer(3))
# c = checkers(computerPlayer(3), computerPlayer(3))

while True and c.currentState.hasEnded() == 0:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pipE.quit = True
            sys.exit()
        elif event.type == pygame.MOUSEBUTTONDOWN:
            x, y = pygame.mouse.get_pos()
            if x >= moveX and x <= moveX2 and y >= moveY and y <= moveY2 and clicks:
                usersmove = " ".join([",".join(i) for i in clicks])
                pipE.move = usersmove
                pipE.ready = True
                clicks = []
                selectState[:, :] = 0
Example #4
0
import checkerLogic
import checkers
import location as p
import AIRandom as air
c = checkers.checkers() #Class used in physical board version
sim = checkerLogic.checkerLogic() #Class used to similute physical board
a1 = air.AIRandom("w")
#while c.check()==None:
"""PLAYERS TURN"""

sim.move([p.location(2, 1), p.location(3, 2)])
c.updateBoard(sim.TFoutput())
c.check()
c.nextTurn()
print(c.getBoard())

sim.move([p.location(5, 4), p.location(4, 3)])
c.updateBoard(sim.TFoutput())
c.check()
c.nextTurn()
print(c.getBoard())

sim.move([p.location(6, 5), p.location(5, 4), p.location(4, 5)])
c.updateBoard(sim.TFoutput())
c.check()
c.nextTurn()
print(c.getBoard())

sim.move([p.location(7, 6), p.location(6, 5)])
c.updateBoard(sim.TFoutput())
c.check()