By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

Executing out of order

P: n/a
I'm creating a neural network to look at tic tac toe. I randomly
create places to 'pick' on the board. When the game is over I test to
see who won.

Theoretically (in the code) my playing board (a 4x4x4 array) is reset
(set to all zeros) after each win or loss is declared. For some reason
when I execute the code it will run the same board through several
times in a row without reseting. When I went to debug it by steping
through I couldn't repeat the error. When I put a delay in the problem
goes away (which is why I couldn't catch it in debug). When I shorten
the pause the problem almost goes away.

I've tried placing my reset() function in different places. I refuse
to believe it's actually doing the execution out of order. Anyone have
some ideas? If you need the code I can post it, but the code I use to
pick the winner is really long and hard to step through.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
<va********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com
I'm creating a neural network to look at tic tac toe. I randomly
create places to 'pick' on the board. When the game is over I test to
see who won.

Theoretically (in the code) my playing board (a 4x4x4 array) is reset
(set to all zeros) after each win or loss is declared. For some
reason when I execute the code it will run the same board through
several times in a row without reseting. When I went to debug it by
steping through I couldn't repeat the error. When I put a delay in
the problem goes away (which is why I couldn't catch it in debug).
When I shorten the pause the problem almost goes away.

I've tried placing my reset() function in different places. I refuse
to believe it's actually doing the execution out of order. Anyone
have some ideas? If you need the code I can post it, but the code I
use to pick the winner is really long and hard to step through.


Possibilities that occur to me:

1. A multi-threaded application that is not properly synchronised.
2. An operating system call that returns immediately before its execution is
complete.
3. Compiler bug (very unlikely).
4. (catch all) Buggy code that you are getting away with in Debug mode by
pure chance.

Both to assist us and perhaps to solve the problem yourself, I suggest you
make a copy of the program and then rip out large chunks of it in order to
isolate the problem. Test it after each removal. If removing something does
solve the problem, then that will suggest that the removed part may have
been the problem.

In particular, resetting to zero should not depend on who wins, so just
substitute a function that declares player 1 as the winner. If you can
reproduce the problem with a short piece of code but can't figure out the
problem with the code, then post it here.
--
John Carson

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.