def drawState(fruitRow, fruitColumn, basket):
global gridSize
# column is the x axis
fruitX = fruitColumn
# Invert matrix style points to coordinates
fruitY = (gridSize - fruitRow + 1)
statusTitle = "Wins: " + str(winCount) + " Losses: " + str(loseCount) + " TotalGame: " + str(numberOfGames)
axis.set_title(statusTitle, fontsize=30)
for p in [
patches.Rectangle(
((ground - 1), (ground)), 11, 10,
facecolor="#000000" # Black
),
patches.Rectangle(
(basket - 1, ground), 2, 0.5,
facecolor="#FF0000" # No background
),
patches.Rectangle(
(fruitX - 0.5, fruitY - 0.5), 1, 1,
facecolor="#FF0000" # red
),
]:
axis.add_patch(p)
display.clear_output(wait=True)
display.display(pl.gcf())
评论列表
文章目录