Skip to content

Commit

Permalink
fix.: correct RandomAgent so it makes random moves
Browse files Browse the repository at this point in the history
  • Loading branch information
SverreNystad committed Apr 9, 2024
1 parent b6d4826 commit 46fbda3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/agents/randomAgent.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from src.agents.agent import Agent
from src.game.board import Board
from src.game.board import Action, Board, get_all_actions

from random import choice

from random import random

class RandomAgent(Agent):
"""Random agent that selects a random move from the list of possible moves"""

def result(board: Board) -> Board:
possible_moves = board.getPossibleMoves()
move = random.choice(possible_moves)
return board.makeMove(move)
def result(self, board: Board) -> Action:
possible_moves = get_all_actions()
move = choice(possible_moves)
return move

0 comments on commit 46fbda3

Please sign in to comment.