chumbucket - 2012-01-05
Your 1000 conjured undead army takes damage from the giant fireball attack...I'm going to roll damage for each now.
|
exy - 2012-01-05
No damned histogram?!
|
Corpus Delectable - 2012-01-05
Tits at 13:57.
|
Robin Kestrel - 2012-01-05
He wants the dice to be centered in the frame. Does he use a dice cup? No. He picks them up and moves them around.
|
kingofthenothing - 2012-01-06
Dude you can get 1000 dice rolls in a second.
This is me modifying the coinflip.py from "Invent Your Own Computer Games With Python." This is python 3. It's Q&D but fuck it it works.
import random
print ('I will roll a die 1000 times. Guess how many times it will come up each number. (Press enter to begin!)')
input()
rolls = 0
ones = 0
twos = 0
threes = 0
fours = 0
fives = 0
sixes = 0
while rolls < 1000:
if random.randint (0, 5) == 0:
ones = ones + 1
if random.randint (0, 5) == 1:
twos = twos + 1
if random.randint (0, 5) == 2:
threes = threes + 1
if random.randint (0, 5) == 3:
fours = fours + 1
if random.randint (0, 5) == 4:
fives = fives + 1
if random.randint (0, 5) == 5:
sixes = sixes + 1
rolls = rolls +1
if rolls == 900:
print ('900 rolls and there have been ' + str (ones) + ' ones and ' + str (twos) + 'twos and ' + str (threes) + 'threes and ' + str (fours) + 'fours and ' + str (fives) + 'fives and ' + str (sixes) + 'sixes so far.')
if rolls == 100:
print ('At 100 rolls, there have been ' + str (ones) + ' ones and ' + str (twos) + 'twos and ' + str (threes) + 'threes and ' + str (fours) + 'fours and ' + str (fives) + 'fives and ' + str (sixes) + 'sixes so far.')
if rolls == 500:
print ('Halfway done, and there have been ' + str (ones) + ' ones and ' + str (twos) + 'twos and ' + str (threes) + 'threes and ' + str (fours) + 'fours and ' + str (fives) + 'fives and ' + str (sixes) + 'sixes so far.')
print()
print('Out of 1000 rolls of the die, there have been ' + str (ones) + ' ones and ' + str (twos) + 'twos and ' + str (threes) + 'threes and ' + str (fours) + 'fours and ' + str (fives) + 'fives and ' + str (sixes) + 'sixes!')
print('Were you close?')
If you want to get the other die just run it again.
|
kingofthenothing - 2012-01-06 shit, the indentation didn't come out right. Sorry about that.
|
|
kingofthenothing - 2012-01-06 I just wanted to advertise "IYOCGwP" a little - it's free and just about anyone can learn from it. Also it took me a lot less time to modify this than it took the guy in the video to make all those rolls.
|
pastorofmuppets - 2012-01-06 i should be less vague. python doesn't actually have arrays, but lists. anyway if you have a bunch of "numbered" variables, it's quicker to treat them as array/list/whatever subscripts. this doesn't really match your program but it should prove the point:
from random import randint
count = [0,0,0,0,0,0] # one for each side
for _ in range(1000):
count[randint(0,5)] += 1
count
dunno if you care... i'm sure that tutorial avoided lists so that it could introduce them later. check out string formatting too.
>> print 'ones: {0[0]}, twos: {0[1]}'.format(count)
doesn't work great for this example, but they're useful in general.
|
|
|
MrBuddy - 2012-01-06
Why not just dump a box with 1000 dice onto the floor?
|
whatevre - 2012-01-10
there are a lot of points being missed here
|
pastorofmuppets - 2012-01-10
"Look," whispered Chuck, and George lifted his eyes to heaven. (There is always a last time for everything.)
Overhead, without any fuss, the stars were going out.
|
Register or login To Post a Comment |