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
6
votes
3answers
2k views

Random number generation in Dice class

I don't intend on implementing this into an application yet as I'm going to test it first. As such, it doesn't do much beyond rolling. It also overloads some "typical" operators such as ...
5
votes
1answer
1k views

Pretty print dice faces from multiple rolls of multi-sided dices

In this question related to rolling multiple dices, the OP pretty prints for a single case where number of dices is less than or equal to 6. This led to me finding this code golf on "Draw dice result ...
11
votes
3answers
5k views

WinForms dice roller

I am writing a dice roller winforms application using C# 2012 VS. Dice roller is set up for playing Shadowrun tabletop. I feel that there might be too much code going into the GUI, but I am unsure ...
6
votes
2answers
1k views

2 player dice game, where even total gains points and odd total loses points NEA task computer science

This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points if it is odd, they lose 5. If there it is a draw after five rounds then the both users ...
13
votes
4answers
23k views

Simple text RPG in Python

I am trying to teach myself to code using Python. The following is the first real program I have written from scratch. I feel that it is messy and in need of improvement, but I am either unsure of ...
7
votes
3answers
1k views

Find the total number of ways W, in which a sum S can be reached in N throws of a dice

I was solving this question: Given there is a 6 sided dice. Find the total number of ways W, in which a sum S can be reached in N throws. Example: S = 1, N = 6 => W = 0 S = 6, N = 6 => W ...
6
votes
2answers
3k views

Two-player dice game for NEA task computer science (Updated)

This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points; if it is odd, they lose 5. If there is a draw after five rounds then both users will ...
24
votes
2answers
1k views

Spin-the-bottle-like game

I've started coding about 3 weeks ago, just for fun and maybe practical uses later. My GF dared me to make a PGM that would replace this dice game where you roll two dice, one with body parts and one ...
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....
11
votes
3answers
6k views

Craps game rules and code

I'm developing a small craps game in C++, and my C++ skills are a bit rusty. I really need someone to review my code to ensure that I have correctly implemented the game according to the rules. ...
10
votes
5answers
2k views

Petals Around the Rose

I have been working on a program that walks you through "Petals Around the Rose". I would like anyone to review it and point out any bad coding practices, as well as efficiency problems. ...
5
votes
1answer
807 views

Ten Thousand: a dice game for multiple players

A fun little game for as many players as you have friends. This is my first Python project so any advice on how to improve is welcome and appreciated. I'm not concerned with the clunky interface as I'...
11
votes
1answer
214 views

Ten Thousand: a dice game for multiple players - follow-up

I've implemented the advice given here and elsewhere as best as I understand: Ten Thousand: a dice game for multiple players I've added a computer player as well. Help me make it even better. What is ...
10
votes
2answers
2k views

Playing “craps” for the win

No specific question here. I am beginning with Java and here is an exercise. The rules of game: You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, ...
6
votes
3answers
20k views

simple two players dice throwing game

I'm a first year uni student. We were asked to come up with code that can represent a simple two players dice throwing game (specifications are given below). I know as a matter of fact that there ...
6
votes
2answers
2k views

Python dice class

I've built a simple dice class utility for rolling dice. It supports weighted rolling, and usage is fairly simple. Here's the code. ...
6
votes
3answers
198 views

Spin-the-bottle-like game, follow-up

I've posted this some time ago. Here is the new version that I made based on all the comments that were made. Another look would be much appreciated, especially on: Getting rid of the ...
5
votes
2answers
14k views

Java Dice Roller

I've written a basic dice program in Java which takes a number of faces then randomly selects a number within that boundary. Here is the code: ...
4
votes
2answers
318 views

Script to determine the outcome(s) of any number of dice rolls

I think this code has far to many if else clauses and not enough abstraction via functions. I would like to break the code down into a series of small functions, or methods if i decide to go OOP, but ...
4
votes
1answer
246 views

Exurbb (automated turn based) Battle Simulator

I have created a semi-medium program (in size) to simulate any battle for all of your battling needs! I would like some feedback on how it is (not to great at programming in c++) or you can just put ...
4
votes
2answers
1k views

Dice-rolling Python script

I completed writing a dice roll script in Python but I thought it looked too messy. Is there anything I should change here? ...
2
votes
2answers
379 views

Playing “craps” for the win v0.2

Continued from Playing "craps" for the win You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come ...
2
votes
1answer
646 views

Move through a basic roguelike text map

I have a basic outline for the best way I can come up with to move a character through a basic text map. I want to implement this module in my simple text RPG. I know there has to be a better way to ...