All problems
Temperature Move Selection
Problem
Sample a move from temperature-scaled visit counts.
weights[a] = counts[a] ** (1 / temperature); with rng = random.Random(seed), draw u = rng.random() * sum(weights) and return the first index whose cumulative weight exceeds u, falling back to the last index.
Hint
This is inverse-transform sampling over the visit distribution.
Test cases
case 1
in: [[4,1,1],1,0]
expected: 2
case 2
in: [[4,1,1],1,1]
expected: 0
case 3
in: [[4,1,1],1,2]
expected: 2
case 4
in: [[10,0,0],0.5,42]
expected: 0
Starter codePython
import random
def temperature_move_select(counts, temperature, seed):
# Your code here
pass4 test cases · run your code against them in the editor