A little script to exercise the Board manually
This commit is contained in:
		
							parent
							
								
									a38f8ca2e8
								
							
						
					
					
						commit
						c725d3764d
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		
							
								
								
									
										14
									
								
								play.py
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								play.py
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,14 @@ | ||||||
|  | #!/usr/bin/env python3 | ||||||
|  | 
 | ||||||
|  | import sys | ||||||
|  | import pprint | ||||||
|  | 
 | ||||||
|  | from tictactoe import Board | ||||||
|  | 
 | ||||||
|  | start = Board(sys.argv[1]) | ||||||
|  | start_score = start.evaluate() | ||||||
|  | print('Start:\n{}\n\nScore: {}'.format(start, start_score)) | ||||||
|  | print('\nChildren:') | ||||||
|  | pprint.pprint(list(reversed(sorted(start.children, key=lambda b: b.score)))) | ||||||
|  | 
 | ||||||
|  | print('\nNext move:\n{}'.format(start.move())) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue