generated from mwc/lab_tic_tac_toe
	Initial commit
This commit is contained in:
		
							
								
								
									
										11
									
								
								strategy/random_strategy.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								strategy/random_strategy.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
from random import choice
 | 
			
		||||
 | 
			
		||||
class RandomStrategy:
 | 
			
		||||
    """A Strategy which randomly chooses a move. Not a great choice.
 | 
			
		||||
    """
 | 
			
		||||
    def __init__(self, game):
 | 
			
		||||
        self.game = game
 | 
			
		||||
 | 
			
		||||
    def choose_action(self, state):
 | 
			
		||||
        possible_actions = self.game.get_actions(state)
 | 
			
		||||
        return choice(possible_actions)
 | 
			
		||||
		Reference in New Issue
	
	Block a user