intelligent-systems-course / schnapsen-old

OLD Codebase for Intelligent Systems 2020 and Project AI, Vrije Universiteit Amsterdam
12 stars 46 forks source link

Number of games for ML bot #3

Open miselico opened 4 years ago

miselico commented 4 years ago

In train-ml-bot, there is a line for g in range(games-1):. It is unclear to me why the -1 is there. I think it should be removed.

jc0b commented 4 years ago

Fairly sure that this is because python indices start at 0. Using the default values, you would then go from 0 -> 1999 inclusive, leading to 2000 iterations.

If you didn’t set the upper limit at games-1, you would do 1 more iteration than intended.

miselico commented 4 years ago

Yes, but range is exclusive. So range(5) give you [0,1,2,3,4]

ursulean commented 4 years ago

This is related to this commit, when the change to range(games-1) happened. I'd guess it was done to prevent some wonky behavior with the progress bar, which was added in the same commit, although now it looks like using range(1, games+1) produces the expected behavior with the correct number of games:

image