Ask coding questions

← Back to all posts
Odds and Evens Competition
AmyScarbrough (0)

I'm a newbie at code and I'll I've done is play around on apps and the Playgrounds. I thought I'd try my hand at making a quick "Odds or Evens" game. Basically, the two players get a randomly generated 1 or 2. If they're the same number (making the result even) one player wins, else the other player wins. My one player is winning every time and I can't figure out why! This is probably really simple but I haven't figured it out yet.

Answered by mattdoan (15) [earned 5 cycles]
View Answer
AmyScarbrough (0)

Never mind. It wasn't a problem with he random number generator. I had player 1 get a point even if player 2 won. LOL. I'm assuming not making simple mistakes gets easier with time.

mattdoan (15)

@AmyScarbrough Nope, even coders with experience make simple mistakes as well; it's just the debugging that gets easier! :)

(Speaking only from personal experience)