Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. [20 pts] 111/p5/Dice.js . Download Dice.js to your 111/p5/folder. A) Complete the rollNDice() method. It should roll N dice and return an array representing

image text in transcribed3. [20 pts] 111/p5/Dice.js.

Download Dice.js to your 111/p5/folder.

A) Complete the rollNDice() method. It should roll N dice and return an array representing the rolls:

Dice.rollNDice(6) => [x,x,x,x,x,x] Dice.rollNDice(3) => [x,x,x]

B) Complete the sumNDice() method:

Dice.sumNDice([1,2,3,4]) => 10 Dice.sumNDice([2,3]) => 5 Dice.sumNDice([]) => 0

C) Complete the maxRoll() function: Dice.maxRoll([1,2,3,4]) => 4

D) Complete the isAllOfAKind() function:

Dice.isAllOfAKind([2,2,2,2]) => true Dice.isAllOfAKind([2,2,2,1]) => false

var Dice sides 6, current DiceRollsArray: default Image Path: ''images /3d dice. png", rollDie: function return Math. floor (Math. random this. sides) 1; rollNDice: function n sumNDice: function diceAry max Roll: function (diceAry) t is AllOfAKind: function (diceAry) get Dice Image Path: function (p) return images/red dice p ".png

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions