Skip to content

A dice rolling simulation script #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2017

Conversation

AmarTrivedi5
Copy link
Contributor

A beginner project for people wanting an example of how you can use while loops, and random.

Key parts of the code is commented, may comment more later to help explain.

I am a little new to Python myself, so please feel free to let me know of any better techniques I can use!

A beginner project for people wanting an example of how you can use while loops, and random.

Key parts of the code is commented, may comment more later to help explain.

I am a little new to Python myself, so please feel free to let me know of any better techniques I can use!
#Checking the user input to start the program.
while correct_word == False:

user_input_raw = raw_input("\r\nWelcome to the Dice Rolling Simulator! We currently support 6, 8, and 12 sided die! Type [start] to begin!\r\n?>")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt string is too long for one line. You may have a variable named prompt_str, and use () to limit characters number.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooo dramtic the words you uesd!!

else:
print "\r\nPlease choose one of the applicable options!\r\n"

#Another inner while loop. This one does the actual rolling, as well as allowing the user to re-roll without restarting the program.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate the comment to multiple lines because it's too long.

while dicer == False:

if user_dice_chooser == 6:
dice_6 = random.randint(1,6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there are too many duplicated codes, could you abstract them (line 68~ 79, line 53~64, etc) to a function.

roller_loop = True

print "Thanks for using the Dice Rolling Simulator! Have a great day! =)"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all right.Good job! but too many dulplicated contents you know,like another reviewer said.

@geekcomputers
Copy link
Owner

geekcomputers commented Jun 3, 2017 via email

@geekcomputers geekcomputers merged commit 916e5ff into geekcomputers:master Jun 3, 2017
@AmarTrivedi5
Copy link
Contributor Author

Thanks for merging and all the tips! :)

@AmarTrivedi5 AmarTrivedi5 deleted the patch-1 branch June 5, 2017 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants