The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [dice]

Simulations of fair N-sided die tosses and other games of chance involving random number generation.

Filter by
Sorted by
Tagged with
12
votes
2answers
2k views

Random D20 number generator

I'm teaching myself code using Zed Shaw's Learn Python The Hard Way, and I got bored during one of the memorization lessons so I thought I would make a random D20 number generator for when I play RPGS....
8
votes
3answers
2k views

Imitate randomness of a dice roll

I have written some code in Java that consists of two classes. I have tried my best and I want you to tell me if I can improve and how good this is. Also, how important is OOP? Java is an object ...
2
votes
1answer
2k views

Craps dice game simulator

This craps game simulator is based on someone else's posted Python code that I've redone for practice. I'm interested in improving readability and making it more pythonic. I used ...
4
votes
1answer
699 views

DnD dice roll parser

Some time ago I've written a small parser (about 250 LoC) which is capable of executing the four arithmetic operators +-*/ as well as a dice-roll operator, ...
7
votes
1answer
5k views

Yahtzee Code Kata in Python

I tried a Yahtzee kata in Python the other day. I'm not particularly experienced in Python (C# is my main language) so I'd be interested in any feedback as to how I could have done things better. In ...
22
votes
2answers
3k views

Ruby Koans' Greed Task

Having coded in Java and C# for quite some years, I'm currently learning Ruby. I'm working my way through the Ruby Koans tutorial. At some point, you are to implement a method that calculates the game-...