Writing bugs
Moderators: hgm, Rebel, chrisw
-
- Posts: 6993
- Joined: Thu Aug 18, 2011 12:04 pm
-
- Posts: 6993
- Joined: Thu Aug 18, 2011 12:04 pm
Re: Writing bugs
Maybe not, but I left it, it's a great reminder!
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 4319
- Joined: Tue Apr 03, 2012 4:28 pm
Re: Writing bugs
Took me a while to track this one down .....
which produces lots of varied games.
Then same thing in parallel, the equivalent of this loop:
What could possibly go wrong?
Code: Select all
while(the cows come home)
{
selfplay(engine_1, engine_1)
append game to file
engine_weights += initial_weights + random(small_variation)
}
Then same thing in parallel, the equivalent of this loop:
Code: Select all
for thread in range(cores)
{
while(the cows come home)
{
selfplay(engine_1, engine_1)
append game to file(thread)
engine_weights += initial_weights + random(small_variation)
}
}
concatenate(files)
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Writing bugs
If one thread finishes its game early and modifies the engine weights while the other threads are still playing, they might not like that? Also, it looks strange with the "+=" in both cases, but probably more serious in the parallel case.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 4319
- Joined: Tue Apr 03, 2012 4:28 pm
Re: Writing bugs
pardon the sloppy pseudo code.
no, it's a more general problem ...
-
- Posts: 395
- Joined: Fri Aug 12, 2016 8:43 pm
-
- Posts: 4319
- Joined: Tue Apr 03, 2012 4:28 pm
Re: Writing bugs
Each parallel batch contains identical games is (was) the problem
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Writing bugs
Code: Select all
int random() {return 42;}
Then your "bug" is directly related to the language "features" you used, not at all to the pseudo-code which tells absolutely nothing.
Martin Sedlak
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Writing bugs
Ok, seriously: you forgot to reseed, no big deal.
This is suspicious as well:
as it would skyrocket the weights quickly. I believe the first += should actually be =
This is suspicious as well:
Code: Select all
engine_weights += initial_weights + random(small_variation)
Martin Sedlak
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: Writing bugs
Code: Select all
for (x = engine; x < MAX_MOVES; x += 2)