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
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 ...
1
vote
1answer
28 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. ...
6
votes
2answers
103 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 ...
6
votes
2answers
980 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 ...
4
votes
1answer
1k 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 ...
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 ...
11
votes
2answers
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 ...
9
votes
2answers
3k 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. ...
5
votes
2answers
130 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. <...
5
votes
2answers
26k 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 ...
3
votes
2answers
157 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 ...
22
votes
6answers
25k 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
68 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 ...
3
votes
1answer
268 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 ...
5
votes
1answer
2k 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 ...
2
votes
1answer
87 views

Simple dungeon game [closed]

Curious on how I can consolidate or generally streamline my code here: ...
1
vote
1answer
578 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 ...
5
votes
2answers
16k 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. ...
1
vote
4answers
484 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 ...
-1
votes
2answers
84 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 ...
2
votes
1answer
715 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 ...
3
votes
3answers
910 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? ...
2
votes
1answer
103 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 ...
8
votes
1answer
182 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 ...
5
votes
3answers
28k 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 ...
1
vote
0answers
107 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, ...
1
vote
1answer
311 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 ...
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. ...
9
votes
6answers
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: ...
4
votes
1answer
2k 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 ...
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 ...
3
votes
1answer
2k 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 ...
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 ...
8
votes
2answers
2k views

Scoring solution for Farkle (dice game)?

I've written the following function on Python (3.3) to take a list of 6 integers and return the maximum score for a game of Farkle. While the results are correct I don't feel it's a very Pythonic ...
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 ...
1
vote
1answer
59 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
124 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 ...
1
vote
1answer
7k 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 ...
7
votes
3answers
77 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
61 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 ...
18
votes
4answers
3k views

Printing all possible sums of two n-sided dice rolls

For my CS class, we were tasked with writing a program that calculates all the possible results from rolling two n-sided dice. For example, the input of 4 would ...
5
votes
2answers
77 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
121 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 ...
10
votes
3answers
1k 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
2k 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 ...
64
votes
3answers
16k views

Monopoly simulator

I was advised by a Reddit user to get my code reviewed on this site. The complete code is on GitHub. ...
8
votes
1answer
249 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
0answers
177 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 ...