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

“Dice on a Yacht” game

I wrote a small program to address some assignment tasks related to making a game called 'Dice on a Yacht'. I sent the code to be reviewed by a company I was applying for, and I have not gotten the ...
4
votes
2answers
2k views

C++ Int Array/Vector Over 100 Million

Textbook style program that generates the values of two, six-sided dice; which are used to perform simple calculations. Recently, I saw an example using similar criteria that was able to utilize 360,...
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
6answers
5k views

Text-based dice rolling game in C++

I have made this small text-based dice rolling game in C++. How could I improve it? Be as picky as you'd like. ...
3
votes
3answers
514 views

Diceware Passphrase Generator

I've written a simple Diceware passphrase generator based on this Stack Overflow question and the top answer. Briefly, in the Diceware method, a die is rolled 5 times for each word in the passphrase ...
2
votes
1answer
654 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 ...
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 ...
6
votes
2answers
178 views

First dice roller

The part I'm really wondering about is in the "if, elif, else" part. I set the variable to bring up the raw input thing so it would stay there long enough to read instead of just printing a response ...
11
votes
2answers
4k views

D&D dice rolling app

This JavaScript object is part of a mobile application that rolls dice for our D&D games. Here are some example of possible inputs from the user: 2d4 2d4 + 3d6 2d4 + 3d6 + 12 ...
7
votes
6answers
336 views

A simple testable standalone DLL for die rolling

I've decided to challenge myself by writing a test standalone DLL with the objective of making all of its publicly-exposed objects able to be as intuitive and as simple-to-use as possible. I've ...
6
votes
1answer
815 views

10-faced dice-rolling game

My code is for a 10-faced dice-rolling game. There are 2 players who start off with 50 points, then they both roll a dice and get a random score between 1-10. The player with the highest roll gets the ...
10
votes
1answer
326 views

Simulate Random Risk Battle

For Prof. Yorgey's 2013 Haskell course, I'm working on a homework to simulate a Risk battle. ...
7
votes
5answers
1k views

Interactive dice simulator

After finishing my course on CodeAcademy, I wanted to write a program. Please provide opinions. ...
2
votes
1answer
239 views

Python Koans multiplayer Greed Game

I finished the Python Koans because I wanted to practise Python and I completed the extra assignment which is the Greed Game (see the rules here). I think there are no flaws but you never know. <...
3
votes
3answers
330 views

Python greed roll

I am doing the Python Koans to practise Python a bit more and I got to the greed dice project. It is a very simple dice game that scores a set of up to five rolls. These are the rules: ...
4
votes
1answer
131 views

Playing “craps” for the win v0.3

Continud from Playing “craps” for the win v0.2 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 to rest,...
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 ...
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, ...
2
votes
1answer
129 views

Greed in Ruby Koans

I've finished the greed problem in Ruby Koans after much confusion. This is my first programming language and I have been doing fine, but then this problem really tripped me up for some reason, ...
3
votes
1answer
274 views

Winforms Dice Control

This is my second Custom Control I have made, a dice. The code below has worked 100% in all my tests, program contains 1 dice control and seven buttons, 6 for setting a number directly, and one for ...
7
votes
4answers
4k views

Dice-rolling program

I am sort of new to programming. I would like to understand the code areas that are garbage and could be better written keeping the exact (if possible) behavior the code has now. ...
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. ...
8
votes
1answer
126 views

Dice Calculation Dialect

As a sample of dialects and teaching myself parse with block! values, I wrote the following dice dialect with the following ...
16
votes
5answers
20k views

Yahtzee game (using arrays and object classes)

As part of an assignment for my intro Java class (please bear with my beginner skill set), I'm working on a program for which a Die object class is used to play a Yahtzee game. An overview of the ...
4
votes
2answers
3k views

Number-guessing game in C++

I created a simple number-guessing game. Do I need to divide this program into functions? Please offer suggestions. ...
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 ...
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 ...
6
votes
1answer
139 views

RubyKoans: Greed dice scoring

The Greed game, from Ruby Koans, where you roll up to 5 dice: A set of three ones is 1000 points. A set of three numbers (other than ones) is worth 100 times the number. A one (that is not ...
3
votes
1answer
608 views

Optimized solution for a rolling dice code puzzle

I was asked to provide the solution of this rolling dice problem in an interview. When I showed him my solution, he said that there is another way to find the solution. I am looking for answer in PHP ...
11
votes
2answers
21k views

Dice-rolling simulator

I know there is a better way to store data. What is the most concise way to simplify this script? ...
4
votes
1answer
1k views

Dice game in Python

Could this script be shortened? ...
11
votes
2answers
827 views

Simple dice roll using std::string as dice notation

This will be a function that returns a random number from Dice Notation (more on Wikipedia). I will later use this function to determine whether some skill check is passed or not. Is there any need ...
3
votes
1answer
941 views

Dice notation roller in JavaScript

I have the following function, intended to take standard dice notation (XdY+Z) and return a (sort of) random number based on the input. Are there any bugs/bad ideas/optimizable sections I am missing? ...
15
votes
5answers
41k views

Basic Java dice game

...
4
votes
3answers
6k views

Yahtzee game in C++

I am doing a little in-between semester reading in my C++ book, and I came up with the wonderful idea to try to make Yahtzee in C++. So far the code generates 5 random numbers and then calls the ...
5
votes
2answers
5k views

Roll a die according to the number of sides that the user enters

I have created a program which rolls a die according to the number of sides that the user enters: ...
20
votes
4answers
2k views

Possible improvements to Risk board game?

Enter risk! This program will roll dice for the game of Risk. The initial input is two numbers separated by a space and if the attackers wish to do a blitz they can add one more space and an "!" to ...
1
vote
3answers
2k views

Modeling a pair of dice using composition in C++

I've written a program all by myself, but I just want to make sure I did it right and if anybody has any suggestions on improving it in any way. Define and implement the ...
7
votes
3answers
2k views

Dice game rules implementation

My in-laws taught me a dice game a couple years ago, and we play every once in a while. A recent excellent answer from @radarbob inspired me to proceed with translating the rules of that dice game ...
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 ...
11
votes
5answers
30k views

Simple Dice Roll game

Is there a more efficient algorithm to generate random numbers in C++? (This code is working on Dev-C++, but I'm not sure if it works on a Borland compiler.) ...
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 ...
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. ...
4
votes
1answer
410 views

Yahtzee program

How can I refactor this? ...
7
votes
2answers
606 views

Python Adventure game

I'm a beginner Python coder and this is the first program that I have ever programmed. Please suggest improvements/bugs. Here's the link to the code. ...
4
votes
1answer
733 views

Die Roller for command line

I've written a die roller which can be run from the command line. It currently exists as three files, but I'll say later why I'd like to make it four. The files are as follows: die.py: Defines the <...
6
votes
1answer
334 views

LPTHW exercise 36 game

This has taken me months to complete. From what little testing I have done, it seems to work. Let me know what I can do to spruce things up. I can't wait to start learning some more advanced ...
7
votes
2answers
4k views

Character generator

I'm a total newbie teaching myself via Zed Shaw's Learn Python The Hard Way and I've gotten bored over a week long memorization lesson, so I thought I would make a character generator for a pen and ...
6
votes
1answer
5k views

RPG Dice Roller

This is sort of a follow up to my post yesterday. I'm a relative newbie to Python and before I made a d20 dice roller for RPGs. Now I've made a dice roller for any type of dice, and I would love ...
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....