summaryrefslogtreecommitdiff
path: root/bots.py
blob: dba440de7892078879828ee447c871016e57f3f2 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import random

def right_bot(board, (x, y)):
    return 'R'

def random_bot(board, (x, y)):
    height = len(board)
    width = len(board[0])
    moves = []
    if x > 0:
        moves.append('L')
    if x < width - 1:
        moves.append('R')
    if y > 0:
        moves.append('U')
    if y < height - 1:
        moves.append('D')
    return random.choice(moves)

def random_bot2(board, (x, y)):
    move = random_bot(board, (x, y))
    nx, ny = x