sigmoidneuron123 commited on
Commit
eefb74e
·
verified ·
1 Parent(s): 3609322

Update selfchess.py

Browse files
Files changed (1) hide show
  1. selfchess.py +3 -1
selfchess.py CHANGED
@@ -5,6 +5,7 @@ import chess
5
  import os
6
  import chess.engine as eng
7
  import torch.multiprocessing as mp
 
8
 
9
  # CONFIGURATION
10
  CONFIG = {
@@ -16,6 +17,7 @@ CONFIG = {
16
  "num_games": 3000,
17
  "stockfish_time_limit": 1.0,
18
  "search_depth": 1,
 
19
  }
20
 
21
  device = CONFIG["device"]
@@ -147,7 +149,7 @@ def game_gen(engine_side):
147
  evaling = {}
148
  for move in board.legal_moves:
149
  board.push(move)
150
- evaling[move] = -search(board, depth=CONFIG["search_depth"], alpha=float('-inf'), beta=float('inf'))
151
  board.pop()
152
 
153
  if not evaling:
 
5
  import os
6
  import chess.engine as eng
7
  import torch.multiprocessing as mp
8
+ import random
9
 
10
  # CONFIGURATION
11
  CONFIG = {
 
17
  "num_games": 3000,
18
  "stockfish_time_limit": 1.0,
19
  "search_depth": 1,
20
+ "epsilon": 0.2
21
  }
22
 
23
  device = CONFIG["device"]
 
149
  evaling = {}
150
  for move in board.legal_moves:
151
  board.push(move)
152
+ evaling[move] = -search(board, depth=CONFIG["search_depth"], alpha=float('-inf'), beta=float('inf')) * random.uniform(1-CONFIG["epsilon"],1+CONFIG["epsilon"])
153
  board.pop()
154
 
155
  if not evaling: