sigmoidneuron123 commited on
Commit
b18f040
·
verified ·
1 Parent(s): 272f597

Update selfchess.py

Browse files
Files changed (1) hide show
  1. selfchess.py +6 -3
selfchess.py CHANGED
@@ -16,7 +16,7 @@ CONFIG = {
16
  "num_games": 3000,
17
  "stockfish_time_limit": 1.0,
18
  "search_depth": 1,
19
- "epsilon": 0.2
20
  }
21
 
22
  device = CONFIG["device"]
@@ -157,8 +157,11 @@ def game_gen(engine_side):
157
  keys = list(evaling.keys())
158
  logits = torch.tensor(list(evaling.values())).to(device)
159
  probs = torch.softmax(logits,dim=0)
160
- idx = torch.multinomial(probs,num_samples=1)
161
- move = keys[idx]
 
 
 
162
  else:
163
  result = engine.play(board, lim)
164
  move = result.move
 
16
  "num_games": 3000,
17
  "stockfish_time_limit": 1.0,
18
  "search_depth": 1,
19
+ "epsilon": 4
20
  }
21
 
22
  device = CONFIG["device"]
 
157
  keys = list(evaling.keys())
158
  logits = torch.tensor(list(evaling.values())).to(device)
159
  probs = torch.softmax(logits,dim=0)
160
+ bests = torch.multinomial(probs,num_samples=CONFIG["epsilon"])
161
+ bestl = []
162
+ for idx in bests:
163
+ bestl += [logits[idx].item()]
164
+ move = keys[torch.argmax(bestl).item()]
165
  else:
166
  result = engine.play(board, lim)
167
  move = result.move