Skip to main content
16 events
when toggle format what by license comment
Dec 15, 2014 at 18:33 comment added RPiAwesomeness @thepace I see what you mean. Definitely something I should have thought of.
Dec 15, 2014 at 18:30 comment added thepace @Dan Allen: Agreed. Can't help that. Seems autocratic and unprecedented :(
Dec 15, 2014 at 18:29 comment added thepace @RPiAwesomeness: In the initial level it would be fine. But as you narrow down the range, it would take time. Consider, max= 10; min = 7; toGuess=9. Just have the random while loop generate a number for such narrow range and check the latency.
Dec 15, 2014 at 18:24 comment added RPiAwesomeness @thepace I highly doubt any modern CPU will have any trouble with that, other than a few milliseconds now or then. However, I can see what you're saying and it makes sense. Cleaner code is definitely something I'm going for! :)
Dec 15, 2014 at 18:23 comment added RPiAwesomeness @SimonAndréForsberg That makes sense. It's a more compact way of getting an answer within the max & min bounds. Thanks for the suggestion!
Dec 15, 2014 at 18:23 comment added thepace @RPiAwesomeness: Point4: It will evade the while loop which could take a while before it produces a number in the required range. So, the game would be more realtime/ fast interaction with the user.
Dec 15, 2014 at 18:20 comment added user59064 I think it's harsh too. The routine {} blocking of if is very a widely adopted practice but not a universal requirement. To me the no-no is placing the conditioned statement on the same line as the condition making it hard to put a break-point on the triggered condition in an interactive debugger and I wouldn't vote that down either. IMHO down vote should be used for answers that are actually invalid rather than stylistically wanting or sound but capable of improvement.
Dec 15, 2014 at 18:20 comment added Simon Forsberg @RPiAwesomeness Although it doesn't affect performance, it affects clean code.
Dec 15, 2014 at 18:19 comment added Simon Forsberg @RPiAwesomeness Computers don't derp, programmers do.
Dec 15, 2014 at 18:19 comment added Simon Forsberg As is said in the question, the computer-guesses-human twist is "version 2". Also, it is much less likely that status == CORRECT so it does actually makes sense having that condition last.
Dec 15, 2014 at 18:18 comment added RPiAwesomeness @thepace First point: I had considered that, if I ever get bored I may go back and add that. Point 2: Because I was messing with Binary. Point 3: Error catching because computers derp some times! Looking at it now, I realize I probably don't need that, but it's never called, so it's not really affecting performance...right? Point 4: Is that something that'll improve performance? Point 5: :)
Dec 15, 2014 at 18:01 history edited thepace CC BY-SA 3.0
added 60 characters in body
Dec 15, 2014 at 18:00 comment added thepace That's harsh. It was more of a informal code. Will udpate it.
Dec 15, 2014 at 17:59 comment added njzk2 -1 for suggesting the use of if blocks without {}
Dec 15, 2014 at 17:57 comment added Jamal I guess the output is the computer attempting to speak to the human player or vice-versa. Perhaps a nice little touch, but still noisy.
Dec 15, 2014 at 17:54 history answered thepace CC BY-SA 3.0