FAQ Database Discussion Community

## Dice Roll Histogram

java,histogram,dice
I have a class question that I cannot seem to understand the logic for. Modify the program below to print a histogram in which the total number of times the dice rolls equals each possible value is displayed by printing a character like * that number of times, as shown...

## Dices, variable function(s), array slice, new button, different function

javascript,arrays,function,variables,dice
I am new to JavaScript, and I need some ideas/help to, how I could make my script work. So the idea is, you roll two dices, that is rolled by pressing a "roll" button and then a reset button that resets everything, in the whole HTML. So here is the...

## Generating a dice game - C Programming

c,dice
I'm following a tutorial on youtube and was doing a dice generator. It basically print out 3 dice result and sum out the dice result. After which, the user will look at the sum, and based on the sum, the user going to guess whether the next roll is going...

## Calculate Dice Roll from Text Field

java,random,eval,jtextfield,dice
QUESTION: How can I read the string "d6+2-d4" so that each d# will randomly generate a number within the parameter of the dice roll? CLARIFIER: I want to read a string and have it so when a d# appears, it will randomly generate a number such as to simulate a...

## How to stock in an Array the points of a Dice? java

java,arrays,dice
My aim is to stock how many times a dice has faced a number between 1 and 6 for 10 throws. It should be something like: 1 = 3 time(s) 2 = 4 time(s) 3 = 0 time(s) 4 = 1 time(s) 5= 1 time(s) 6 = 1 time(s) Total...

## Basic Java Dice program - trouble finding longest streak

java,arrays,dice
I'm currently working on a basic (and as I can see, frequently assigned) java project in which I'm to create a program that simulates the rolling of dice. In my project I'm only simulating the rolling of two six sided die. Arrays need to be used in completing this task....

## 3 Dice Sum Counting Program Java

java,arrays,sum,counting,dice
For my Computer Science Class, my teacher is asking us to do the following: Program Description: You are learning to play a new game that involves 3 six-sided die. You know that if you knew the probability for each of the possible rolls of the die that youâ€™d be a...

## poker dice in java - not giving scores properly

java,dice,poker
I want to create a poker dice game in java, and when the player rolls the dice, I want the program to tell the results and the current score. However, something is wrong. It isn't giving me properly the score. For example, I changed the the Math Random algorithm to...

## Python 3 random.randint() only returning 1's and 2's

function,python-3.x,random,dice
I thought I'd finally worked out all the kinks in the dice rolling code I wrote for practice, but then apparently I forgot to save my work last night, and when I rewrote it this afternoon, the random.randint function didn't seem to be returning any numbers other than 1's and...

## Python define parameter issues

python,random,dice,def
My program rolls n die depending on input however only ever does on at a time. tried making it go back to d20() with another one in the if but doesn't seem to do anything. import random min = 1; print "1. d20 \n2. d12 \n3. d10 \n4. d8 \n5....

## How to detect certain numbers from a dice roller?

python,python-3.x,dice
I have made a text-based RPG that uses dice rolling for the combat system. If you get a 1, your attack is forfeited. You can keep rolling until you get a one, or type 'attack'. I made a dice roller, and I just want to know, how to make it...

## Nested computation of Cartesian-product of dice rolls

python,permutation,itertools,dice,cartesian-product
I'm working on a Python program where I have to come up with all the ways to roll 9 4-sided dice. I've been trying to come up with a more concise way to write this line: for n in [sum([a, b, c, d, e, f, g, h, i]) for a...

## Basic Java dice representation

java,dice
I'm trying to make a representation of a dice in Java with a given classes(Square, Circle and Canvas), I have represent the box of the dice with the square but at the time of represent the n circles I have made a Circle matrix, but it doesn't appear, this is...

## create array union for advanced taxt compare like Jaccard index

php,algorithm,dice
I'm trying to develop functionality to create an union on 2 arrays to compare large text. For example: \$myText1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis eleifend sem. Maecenas at elit varius erat malesuada mollis. Nullam vulputate, velit vel posuere finibus, ex quam imperdiet lorem, eu...

## Dice Sum Probability with Different types of Dice

java,probability,dice
I am currently working on a java application where I need to calculate the probabilities of rolling each sum for a variety of dice. The dice types I am supporting are d4 (4 sided dice), d6 (6 sided dice), d8 (8 sided dice), d10, d12, and d20. The user will...