# Questions tagged [dice]

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

164 questions
Filter by
Sorted by
Tagged with
871 views

### c++ dice game using random numbers

I'm fairly new to c++ programming. It would be helpful if I could get a feedback on a dice game I wrote. I would really appreciate some tips as well as your opinions. This program will begin by asking ...
564 views

### Dice throwing simulation in Java

For one of my labs I need to write a complete java program which will simulate a "very simple" dice betting game. The specifications are as follows: simulate the throw of 3 dice. If you ...
64 views

### NEA Computing Task 2 Dice Game

I was recently set Task 2 as seen below and I realise someone answer the question on this site here but I wanted a fresh opinion TASK 2: Allows two players to enter their details, which are then ...
661 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 ...
134 views

### Vue component for Game Die (dice)

As part of learning Vue and Vue Test Utils I develop some simple games. I made a simple version of craps. Because in many other games a die (or dice) is used, I decided to create a reusable component <...
89 views

### Dice rolling simulator, any ideas on implementing any features?

This is one of my mini project of dice rolling and I want to improve it further with more advanced Python. Maybe you have any ideas to improve the code itself? This code will ask the minimum and ...
11k 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, ...
1k views

### Arbitrary Dice with Probability

I wrote a script that gives a "generalized" function of an arbitrary dice. Is this any good? How can it improve so to make it cleaner? ...
162 views

### Dice game with rules and three dice

I'm trying to make a dice game with three dice and with rules. It costs 10 credits to roll the dice. If you get 6 6 6 you win 90 credits. If you get 5 5 5, 4 4 4, 3 3 3, 2 2 2, 1 1 1, you win 40 ...
38 views

### Frequency analysis for simultaneous dice rolls - follow-up

I had another question for my Perl class assignment. Related question: Frequency analysis for simultaneous dice rolls ...
76 views

### Frequency analysis for simultaneous dice rolls

My professor told me to optimize my perl code, but he wouldn't tell me what exactly - just make it simpler. I changed some little things but nothing major. Am I missing something? The task was: ...
1k views

### PigDice game in C#

In the C# Player's Guide book there's a challenge in which you have to write the PigDice game in C#: It's a multiplayer game, every player starts with score 0. Player X rolls 2 dice. Player ...
571 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, ...
13k 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 ...
542 views

### Python Dice Game

How would I clean this code/shorten it (most of it is login) What the program does: Only authorized players are allowed to play. Input from user should be validated where possible. 5 rounds. Score ...
3k views

### Dice roll program with statistics

This is a working program I made to roll dice a specified number of times, show how many times each number (2-12) occurred, and the percentage of the total rolls that each number got. I'm trying to ...
6k views

### 2 player dice game with login system

This is a two player dice game where two players each roll two dice. If a player's dice sum is even, they gain 10 points. If the dice total is odd, they lose 5 points. ...
57 views

### Function to determine the effect of a lightning bolt on a game character using “abilities” [closed]

I'm writing my first game and would love some advice on how to get away from all this hardcoding I'm using... Each Character has "abilities" (all individual functions) but I can't seem to figure out ...
56 views

### D&D Dice Roller

Here I have a program I made to be an all-in-one Dungeons and Dragons 5th Edition (it probably works for other games as well but this is the only one I'm familiar with and the one it was primarily ...
33 views

### Generating HTML for prerolled d20 RPG initiative tables

A fairly simple program that I tried to write in Common Lisp in order to practice/learn. I'm sure this can be done more elegantly but Lisp's string handling seems to be very werd. ...
275 views

### Generate EFF diceware passwords with Python

I wanted to write a commandline scipt to generate diceware passwords based on the EFF diceware list. The script (diceware_password.py) can be found below. It was ...
3k 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 ...
3k 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 ...
28k 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 ...
2k 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 ...
360 views

### A betting game using a dice class in C#

This is my first project over 100 lines and I would like some feedback on it. If anyone has any ideas for things to add or ways to make the code more efficient they would be very much appreciated. <...
61k 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 ...
188 views

### Strategy advisor for a Yahtzee Roll

I'm implementing a Yahtzee app and i have a class StrategicAdvisor that is responsible for deciding which strategy should be followed. The ...
38k 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. ...
252 views

### Two-player Yahtzee game

I am working on a Yahtzee game development for two players that consists of all the categories Full house, Yahtzee, ones, twos, threes, etc. I have implemented the interface that works for two ...
2k views

### Dice game in HTML, JS, & CSS

I'm working on a personal game project to hone my CSS, HTML, and vanilla JS skills. I would appreciate any feedback on my small dice game project. ceelo-js Codepen The main logic of the game is run ...
4k 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 ...
258 views

### Simple dungeon game [closed]

Curious on how I can consolidate or generally streamline my code here: ...
720 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 ...
23k views

### Dice Roll Program in C

I've made a dice game that rolls three die, calculates the sum of their results, and asks the user whether he/she thinks the next roll's total will be higher, the same, or lower than the current roll. ...
2k views

### Calculate probability of dice total

I am working on a project to get dice probability that requires 4 decimals places. My code works great, until the dice become huge (as I use in the example below). I am wondering if there is a way to ...
85 views

### Arbitrary probability dice

I have to make this: Each set consists of a number of equal objects that generate numbers from a finite set with an arbitrary probability distribution. I did make it, but it feels so long. How can I ...
45k views

...
2k views

### Dice game for two players (Nea)

The rules: The points rolled on each player’s dice are added to their score. If the total is an even number, an additional 10 points are added to their score. If the total is an odd number, 5 points ...
302 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 ...
199 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 ...
37k views

### Dice rolling game

I am 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 it spits ...
310 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, ...
729 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 ...
620 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. ...
4k 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: ...
3k views

### A dice roller in node.js

I knocked out a dice roller in 2 days. I think this is the first coding project I've ever actually completed to a degree where I'm not embarrassed to post it. This is my first time working with ...
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 ...