Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [dice]

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

-2
votes
0answers
18 views

JavaScript basic dice (help) [on hold]

Hey I need a basic solution to this task if anyone can help me by using JavaScript. a. First, the score for each dice is written (i.e., 5th prints) b. Count the number of sexes and store it in a ...
1
vote
0answers
33 views

Dice-rolling tool

I am an experienced programmer, but a complete beginner with React. My goal is to teach myself React. I've made a simple die-roller application. The application presents a drop-down, and the user can ...
3
votes
1answer
99 views

2 player dice game

This is a finished project where Two people roll a dice twice and if the total of the two dice are even it adds 10 points to the two dice rolls and if the total is negative it takes away 5 points from ...
1
vote
0answers
23 views

Tensorflow model for predicting dice game decisions

For my first ML project I have modeled a dice game called Ten Thousand, or Farkle, depending on who you ask, as a vastly over-engineered solution to a computer player. You can find the complete game, ...
2
votes
2answers
123 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 ...
1
vote
1answer
60 views

Python 3.6 Dice Histogram: Using random.seed effectively

I am not 100% sure that I am using the random.seed correctly for this assignment, or if there is a more efficient way to write the code. Any feedback is appreciated. Assignment Description: Simulate ...
9
votes
6answers
3k views

A dice game called “Greed”

This game is a variation of the Greed dice game. Imagine we have 5 dice. We roll, them, and jot down the results. Then, based on this chart: ...
6
votes
1answer
1k views

An ASCII histogram of a die rolled n times

A die is rolled n times. Each time, a random value has been inserted into a vector. This vector then is used to generate a sorted map (wrongly called hashmap in the code) that is later used to create ...
1
vote
1answer
33 views

Counting results of die rolls

The algorithm bellow is meant to allow a user to roll a die as many times as he would like, then print how many times each side was rolled and how many rolls there were total. ...
2
votes
0answers
97 views

Solo dice game (from Reiner Knizia’s Decathlon)

I'm trying to implement Reiner Knizia’s Decathlon, a set of 10 solo dice games played with 8 dices named after Decathlon events in Olympics. The first event is called "100 Metres". The player divides ...
4
votes
2answers
2k views

2-player dice game

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 tie after the five rounds, then the users have ...
7
votes
3answers
68 views

Evaluating Dice Poker results

In Dice Poker (or Yacht), a player rolls 5 standard dice (sides 1 - 6) and the resulting roll is given a score based on combinations: Two matching dice only - pair Three matching dice only - three ...
4
votes
1answer
53 views

Systematically analyzing dice roll outcomes

I created a generator function to iterate through all possible dice rolls, and then applied it the ability score generating methods in Pathfinder RPG. (Obviously, there are more efficient ways to ...
5
votes
2answers
62 views

Regex-based parsing of a specifier for dice

In this android app, the user can enter (a subset of) roll20 notation to roll that many dice. Inputs will look like "4d6" at the simplest, but the user can also add or subtract numbers, and drop or ...
6
votes
6answers
2k views

Simple Python Dice [closed]

I made a really simple Dice class and test script in Python as a gist. It is simpler than other dice I found on StackExchange being here and here. I made it simple for modularity and reusability. ...
5
votes
2answers
75 views

Java implementation of a Dice Roller

In order to keep my coding skills fresh, I am going to be implementing a simple D20 RPG engine/library to use in creating a text-based game. I am coding in with IntelliJ using Java 8. I'm focusing on ...
11
votes
2answers
1k views

Dice simulator program

I recently began to dabble into the programming world and wrote a Dice Simulator Program. How do I know that I'm writing Good Code? In the sense, is it something similar to how a major Software ...
10
votes
3answers
554 views

Simple dice game - JavaScript MVC implementation

I did a simple dice game using what I learned about separating the 'view', 'model', and 'control'. I am quite clear on what the model is (it's the data and state). But I'm a bit confused on the ...
1
vote
3answers
500 views

Pig, the Dice Game

I'm writing a program in Java, a game called Pig. The rules are: There are two players. Each take turn to roll a 6-sided die; a player repeatedly rolls it until the player chooses to stop rolling and ...
4
votes
0answers
143 views

Ten Thousand: a dice game for multiple players v0.3

I've learned so much, how could I not come back for more? I think this is much improved. The only thing I have not implemented from Ten Thousand: a dice game for multiple players - follow-up is ...
11
votes
1answer
190 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 ...
1
vote
1answer
175 views

Dice roller in Ruby (mainly for D&D)

I have been working with Ruby for about a week or two now, and I wanted to create a dice-rolling application that intakes any string (e.g. 1d4 + 1 or 3d20 + 4) and outputs the correct dice rolling. <...
5
votes
1answer
564 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'...
1
vote
2answers
574 views

Simple console dice game, trying to roll two of the same number

I'm a young and beginner Java programmer and I'm starting to learn again Java (used it in the past years at school) since I want to enter a competition and (hope to) win for getting a job. I wanted to ...
8
votes
1answer
205 views

SFML dice game with logic-presentation separation

I asked for feedback on my Dice class and I was suggested that I should separate logic from view. I decided to completely refactor my project and I'd like to share ...
4
votes
3answers
370 views

Basic python dice simulator with log function

I had created a dice simulator using nothing but functions, but I wanted to attempt one using a class for the dice just to help get a better understanding of classes. I'm still a little in the dark ...
7
votes
0answers
156 views

Python port of Java dice game algorithm

I am in the process of learning Python (background in C++ and R). So after the obligatory "Hello World", I decided that my first non-trivial program would be a port of a Java implementation of the ...
1
vote
0answers
46 views

Pig game in Angular4

I am a newb in Angular 4. I have written a component but have some questions. I used member variables of class and modified variables within functions. Is this right approach or I should implement it ...
7
votes
2answers
2k views

Dice game where two players try to get to 49

Is there an easier way to make a dice game where 2 people roll a dice to try and get to 49? If there is, the program should output the person who has won. After the game has ended, please use the <...
1
vote
1answer
5k views

Multiple dice roll game with multiple players

I feel as if I did not write it efficiently. Any suggestions on slimming? I had trouble when player 2 would guess the number the first try, it would say player 2 won but keep continuing to the re-roll ...
4
votes
2answers
400 views

Rolling 100-sided “dice” until they are the same number

I've just begun my journey into python (1 week now) and I've written couple of lines incorporating everything I've learned so far. It would be greatly appreciated if anyone could guide me in writing a ...
3
votes
1answer
724 views

Rolling Dice Simulation using Tkinter

I just wanted to post my code to request for any improvement. Originally, I did NOT come up with this code, but rather I 'improved' it visually (i.e. not performance). This code originally had several ...
6
votes
1answer
1k views

Pig Dice Game: Luck game to get to 100 points

I have a dice game called Pig to play (a simple google search will show rules, they are included in my .js file as well). I am new to JavaScript and the main goal of this code review is to give me an ...
4
votes
3answers
19k views

Dice rolling game

I am extremely new to programming and I tasked myself with the challenge of making a dice rolling game. It goes from 1 to 6 and it first asks you if you're interested in playing. Then it rolls. Then ...
3
votes
2answers
227 views

Greed Dice Scoring Game expanded - Python Koans

I've been trying to level up my python skills (more experienced in other languages) by working through the python3 version of Python Koans. After completing the "greed dice scoring project" exercise, ...
7
votes
4answers
4k views

Rolling dice simulator with probability

I'm a beginner at Python, and to start off my learning progress I created a simple program which will roll a dice and decides the probability of it. It would be great to have criticism on my code, ...
2
votes
3answers
170 views

Generate die rolls using coin flips

Problem I've seen this basic interview question in a couple of places, but never implemented it. Create an algorithm to output a fair die roll (values between 1 ...
1
vote
2answers
203 views

Strategy game move involving countries and dice

I have a game that consists of multiple countries and each of them has several choices. For instance, First Country(France) has multiple choices, Choice 1, Choice 2, Choice 3, .......etc And the ...
5
votes
1answer
224 views

Simple game in C++ involving a dice and bolts

I have been working on a simple game in c++. the game consists of a dice and several players. the number of players may very between 1-4 and as long as each of them has 2-4 bolts. singleton ...
1
vote
2answers
192 views

Dice roll game that generates random number

I just want to know how efficient is my code and is there any better way to do the same program in C? Can the if statements are replaced with something else or can I merge the two loops together to ...
3
votes
2answers
1k views

Simple dice console game in C#

I wrote a little console game that is supposed to take some dice and some players and determine the winner of the game. I wrote it for the sole purpose of figuring out why i'm doing the things i'm ...
22
votes
6answers
15k views

Simple text-based RPG in Java

I was looking for suggestions on how to improve the general flow of this code, as well as minimizing if / switch conditionals. ...
0
votes
1answer
260 views

Computing the probability of rolling a given total with five dice

I'm trying to compute the probability of rolling a certain dice total with an unknown number of dice. Below is a brute force example for 5 dice, hence the 5 loops. I feel like there is a recursive ...
1
vote
1answer
52 views

Exurbb (automated turn based) Battle Simulator Revised

I have revised my other question's code which you can find a link to here. This is just an automated turn based battle simulator which means everything comes out about 1 second at a time, and player ...
4
votes
1answer
165 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
1answer
640 views

Python - Random dice

I am a fairly new programmer, and I stumbled with a beginner practice project, a random dice number generator. The code works, but I would like to know if there is an efficient way compared to mine to ...
7
votes
1answer
126 views

Random Dice Simulation

I extended the example in 04-random.elm to support N dice and to draw the results using SVG. ...
5
votes
0answers
60 views

Evaluating RPG-formatted dice rolls with repeats in Clojure

My target was to write a function that takes a String as input, interprets it as a series of dice rolls, evaluates it and returns a series of integers. The input is in a form that is typical in table ...
7
votes
1answer
347 views

Python dice game: C Low (Special Edition)

I am a Python noob and over the last week it has been my goal to learn how to write python code. As my first project I decided to create a dice game called C low. This is a version of that game that ...
7
votes
3answers
844 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 ...