RUSHWRITER-LOGO

lab 9 numpy arrays

Background

  • In a modified game of Yahtzee, five eight-sided dice are rolled once.
  • For this assignment, you will simulate this modified game of Yahtzee to determine how likely certain outcomes are.
  • In this modified version of Yahtzee, a Low Roll occurs when each of the five dice is either a 1 or an 2. For example, 1-1-1-1-1 or 2-2-1-2-1.
  • In this modified version of Yahtzee, a Three of a Kind occurs when three of the dice show the same number. The other two dice must not show this number and must also be different from one another. For example, 4-7-4-4-2 but not 4-7-4-4-7.
  • In this modified version of Yahtzee, a large straight occurs when the five numbers can be arranged consecutively (for example, 1-3-4-2-5 or 5-7-4-6-3). Hint: the numpy library contains a sort function.

Assignment

  • Download lab9.py (below) rename it according to the instructions above, and make sure you understand it.
  • Take the program above and modify it by adding the missing methods such that when the program is run, it might produce the output below. Do not change any of the existing Python code (except to learn it — if you do, change it back).

Grading – 10 points

  • 3 points – Low Rolls are identified correctly.
  • 3 points – Three of a Kinds are identified correctly.
  • 4 points – Large straights are identified correctly.

Sample Transcripts

Below are a few runs of the program. Notice it can vary a bit from run to run, but with a sample size as large as 20,000, it tends to be fairly close…

Need Help Writing an Essay?

Tell us about your ESSAY and we will find the best writer for your paper.

Write My Essay For Me
>>> 
= RESTART: /Users/danieldefrance/Google Drive/CSCI/Courses/04_2020S/127/Assignments/lab09/Daniel-DeFrance-Lab09.py
Number of Rolls: 20000
---------------------
Number of Low Rolls: 15
Percent: 0.07%

Number of Three of a Kinds: 2384
Percent: 11.92%

Number of Large Straights: 331
Percent: 1.66%

>>>
= RESTART: /Users/danieldefrance/Google Drive/CSCI/Courses/04_2020S/127/Assignments/lab09/Daniel-DeFrance-Lab09.py
Number of Rolls: 20000
---------------------
Number of Low Rolls: 17
Percent: 0.09%

Number of Three of a Kinds: 2404
Percent: 12.02%

Number of Large Straights: 316
Percent: 1.58%

>>>
= RESTART: /Users/danieldefrance/Google Drive/CSCI/Courses/04_2020S/127/Assignments/lab09/Daniel-DeFrance-Lab09.py
Number of Rolls: 20000
---------------------
Number of Low Rolls: 17
Percent: 0.09%

Number of Three of a Kinds: 2374
Percent: 11.87%

Number of Large Straights: 286_x000D_ _x000D_ Percent: 1.43%

The post lab 9 numpy arrays appeared first on Savvy Essay Writers.

I absolutely LOVE this essay writing service. This is perhaps the tenth time I am ordering from them, and they have not failed me not once! My research paper was of excellent quality, as always. You can order essays, discussion, article critique, coursework, projects, case study, term papers, research papers, reaction paper, movie review, research proposal, capstone project, speech/presentation, book report/review, annotated bibliography, and more.

STUCK with your assignments? Hire Someone to Write Your papers. 100% plagiarism-free work Guarantee!

PLACE YOUR ORDER