Example #1
0
def main():
    scratch.init()
    scratch.newGame()
    scratch.printAll()

    scratch.simulateGame()
    scratch.postGameToTumblr()
Example #2
0
def main():
    scratch.init()
    scratch.newGame()
    scratch.printAll()

    scratch.simulateGame()
    scratch.postGameToTumblr()
Example #3
0
    def get_best_move(self, board, rack):
        print 'get_best_move'
        scratch.newGame()
        scratch.setBoard(board)
        scratch.setCurrentRack(rack)
        scratch.printAll()
        results = scratch.bestMove()

        pos = scratch.DirectedPosition(results[2][0], results[2][1], results[2][2])
        move = {}
        scratch.placeWord(move, pos.row, pos.col, pos.vert, results[1].upper())

        return move
Example #4
0
    def get_best_move(self, board, rack):
        print 'get_best_move'
        scratch.newGame()
        scratch.setBoard(board)
        scratch.setCurrentRack(rack)
        scratch.printAll()
        results = scratch.bestMove()

        pos = scratch.DirectedPosition(results[2][0], results[2][1],
                                       results[2][2])
        move = {}
        scratch.placeWord(move, pos.row, pos.col, pos.vert, results[1].upper())

        return move
Example #5
0
def runBot():

    scratch.init()

    while (True):
        im = getImage()
        if selectOpenGame(im):
            time.sleep(2)
            clickImage(wwfAccept)
            shuffleOrRecall()
            im = getImage()
            rack = {}
            board = {}
            for i in range(7):
                rack[i] = getRackTile(im, i)
                print(rack[i],)
            print
            print
            for i in range(15):
                board[i] = {}
                for j in range(15):
                    board[i][j] = getBoardTile(im, i, j)
                    print(board[i][j],)
                    if board[i][j] == ' ':
                        board[i][j] = None
                print

            scratch.newGame()
            scratch.setBoard(board)
            scratch.setCurrentRack(rack)
            move = scratch.bestMove()
            print(move)
            playMove(board, rack, move)

        else:
            print("Not my turn %d" % (int(time.time())))

        time.sleep(5)
Example #6
0
def runBot():

    scratch.init()

    while (True):
        im = getImage()
        if selectOpenGame(im):
            time.sleep(2)
            clickImage(wwfAccept)
            shuffleOrRecall()
            im = getImage()
            rack = {}
            board = {}
            for i in range(7):
                rack[i] = getRackTile(im, i)
                print(rack[i], )
            print
            print
            for i in range(15):
                board[i] = {}
                for j in range(15):
                    board[i][j] = getBoardTile(im, i, j)
                    print(board[i][j], )
                    if board[i][j] == ' ':
                        board[i][j] = None
                print

            scratch.newGame()
            scratch.setBoard(board)
            scratch.setCurrentRack(rack)
            move = scratch.bestMove()
            print(move)
            playMove(board, rack, move)

        else:
            print("Not my turn %d" % (int(time.time())))

        time.sleep(5)