Quantcast
Channel: Sharing Computer Science Project #1 - Coin Flip looking for feedback
Viewing all articles
Browse latest Browse all 3

Sharing Computer Science Project #1 - Coin Flip looking for feedback

$
0
0

@corotox wrote:

First of all, @patrickd314 Thank you very much for taking the time to review and analyze the code.

Ok, this statement blew my mind lol. This is the kind of feedback i was hoping for, a better or more sophisticated approach opposed to my “naive approach”. While i was thinking like i write, you brought a more programming-oriented solution. Thanks for that.

I think i got the idea here, and again, it blew my mind lol. The first time we enter this whole section, there won’t be a “play another” prompt (like its supposed to happen because we are playing for the first time), so the code will run 1 time and go to the bottom part where we will get the prompt, save the variable value and go to the beginning of the while loop. Again, i think i got it.

Now, about your favorite structure, i was thinking about how to keep the counters updated, and i can say honestly that i didn’t think of declaring some play_counters with 0 value inside the args of the function. At some point i had at the end, instead of return a return w/e counters i wanted but i discarded that idea, or didn’t think of making a play function then games inside that.

This is about the same as i explained before, thanks for claryfing how to make the prompt fool proof lol.

Pretty clear here, first, game is saved as string, compared (or parsed) in the string “123” then passed to the rest of the code as int so we can select the game.

Putting the counters outside the game functions is another clear improvement; so we return from the game with game counters and add them to the play() function counters. This play() then games() tree structure of functions is a lot better than having separate functions interacting each other.

Thank you very much for the feedback. I hope to retrieve this in form of feedback to another fellow learner.

Kind regards…

Read full topic


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images