[Home]History of MatchIsOver

Robo Home | Changes | Preferences | AllPages


Revision 11 . . March 4, 2003 0:09 EST by PEZ
Revision 10 . . March 3, 2003 23:44 EST by Ray Vermette
  

Difference (from prior major revision) (no other diffs)

Changed: 1,11c1
How do I know the match and/or round is over? I have the same problem when my robot prints statistics at the end of each round. There I've put calls to my printStatistics function inside onWin? and onDeath event handlers. But they sometimes occur both and then I get two prints of statistics. It hasn't been important enough for me to deal with, but this persistence issue is different. So now, can someone tell me how to figure out that the round is over? And the match? Or maybe if I know when a round is over I can just check if it's the final round using getRoundNum()? -- PEZ

You could call a clearAllEvents?() at the end of onWin?() and onDeath() to avoid the second printout. --Dummy

Thanks, I'll do that. So this means that these two events are the only clues to that the game is over? -- PEZ

What about using getRoundNum() and getNumRounds?()? When the first is 1 less than the second then you are in the final round of the battle. --Tad

Perhaps using getOthers?() and checking when it reaches 0 (or 1 if it includes your robot which I don't think it does.) That should do the trick. --Miked0801

It doesn't include the own robot. But if I get killed, then that call will never return 0, will it? Anyhow, I have decided to use the onWin?() and onDeath() calls and not bother if I write the statistics file twice. Tad's suggestion works fine for knowing I'm reaching the end of the match. But I'm not sure I will keep it that way, since then if I stop the game prematurely I wont save the statistics. I still think there is an onGameOver?() event missing. -- PEZ
How do I know the match and/or round is over?

Added: 12a3,4
/Discussion?

Solution




Added: 23a16,18
-- Ray Vermette

Anyone that has peeked at the code of TheArtOfWar will recognize that. =) -- PEZ

Robo Home | Changes | Preferences | AllPages
Search: