In class this week, we will work on simulating the game of Yahtzee. In the game of Yahtzee, five dice are tossed, and various combinations of numbers, similar to poker hands, are assigned point values. In the game, dice can be selected and re-tossed, but we will focus on calculating the probabilities for the first toss only. We will also deal only with the "lower half" of the score card in the game. For the interested student, continuing this project to account for the complete rules of play would be an entertaining challenge. Anyone not familiar with Yahtzee should try a web search for the rules of the game. Some sites have applets that let you play online. All you really need to know for this lesson, though, is which combinations are counted. We will call these "hands," as the combinations in poker are called. The hands in Yahtzee are: Three of a Kind (three of one number and two others that are different) Full House (three of one number and two of another number) Four of a Kind (four of one number and one other) Yahtzee (five of the same number) Small Straight (four consecutive numbers) Large Straight (five consecutive numbers) Chance (anything that does not fit the above patterns) We begin by simulating dice rolls. For example we can simulate one roll of a die to be: library(tidyverse)roll <- sample(1:6, size=1, replace=T)roll   Given this information, please answer the following question attached using R. Show the R code.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In class this week, we will work on simulating the game of Yahtzee. In the game of Yahtzee, five dice are tossed, and various combinations of numbers, similar to poker hands, are assigned point values. In the game, dice can be selected and re-tossed, but we will focus on calculating the probabilities for the first toss only. We will also deal only with the "lower half" of the score card in the game. For the interested student, continuing this project to account for the complete rules of play would be an entertaining challenge.

Anyone not familiar with Yahtzee should try a web search for the rules of the game. Some sites have applets that let you play online.

All you really need to know for this lesson, though, is which combinations are counted. We will call these "hands," as the combinations in poker are called. The hands in Yahtzee are:

  • Three of a Kind (three of one number and two others that are different)
  • Full House (three of one number and two of another number)
  • Four of a Kind (four of one number and one other)
  • Yahtzee (five of the same number)
  • Small Straight (four consecutive numbers)
  • Large Straight (five consecutive numbers)
  • Chance (anything that does not fit the above patterns)

We begin by simulating dice rolls. For example we can simulate one roll of a die to be:

library(tidyverse)roll <- sample(1:6, size=1, replace=T)roll
 
Given this information, please answer the following question attached using R. Show the R code.
1.1.1. Problem 1.
Using a loop create a matrix of 10 rolls all consisting of 5 dice in each roll. Then, rewrite your code to avoid
using a loop.
[2]: # Solution with Loop:
[3]: # Solution without loop:
Transcribed Image Text:1.1.1. Problem 1. Using a loop create a matrix of 10 rolls all consisting of 5 dice in each roll. Then, rewrite your code to avoid using a loop. [2]: # Solution with Loop: [3]: # Solution without loop:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education