99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務合肥法律

代寫CS 8編程、代做Python語言程序

時間:2023-12-12  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯


CS 8: Introduction to Computer Science

Fall 2023 Final Project

Due Tuesday, December 12, 11:59PM (California time)

In the game Yahtzee, players try to get particular combinations of five six-sided dice. For

a given turn, they can make up to three rolls: on the first roll, they roll all five dice; on

the second roll, they can choose to re-roll none, any, or all of the dice again; and on the

third roll, they again can choose to re-roll none, any, or all of the dice again. The best

outcome for a given turn is to get what’s called a Yahtzee, in which all five dice have the

same value on them. It doesn’t matter what that value is, just that they are all the same.

Here is an example. For the first roll, say a player gets:

2 4 1 6 4

Let’s say they choose not to re-roll the two dice that were 4’s, but they do re-roll the dice

that were 2, 1, and 6, giving new values for those three dice:

4 3 4

So at this point, after their second roll, the five dice are:

4 4 3 4 4

(Here I’m keeping the dice “in order”: the dice which was previously a 2 is now a 4, the

dice that was previously a 1 is now a 3, and the dice that was previously a 6 is now a 4.

The dice that were previously 4’s stay as 4’s.) For the player’s third roll, they choose to

only re-roll the dice that is a 3, and let’s say it comes up 4. So after the third roll, the

five dice are:

4 4 4 4 4

They all are the same! Yahtzee!

In this final project, you will write Python code to calculate the probability that a player

will get a Yahtzee on a given turn using the following strategy: You always try to get a

Yahtzee with the highest dice value for which you have the largest number of matching

dice. So if your dice are

4 2 4 5 2

you would keep the 4’s, and re-roll the 2’s and the 5.

There is also a related game called Tenzi, in which each player has ten 6-sided dice. On

the first roll, they roll all ten dice. On the second and all subsequent rolls they can choose

1

to re-roll none, any, or all of the dice again. They keep rolling until all ten dice have the

same value on them - a Tenzi! In this final project, you’ll also write Python code to keep

track of how many rolls it takes in order to get a Tenzi.

Please use the following code in order to generate a random integer 1,2,3,4,5, or 6:

import random

def rollDice():

return random.randrange(1,7)

Your main program should prompt the user to either play Yahtzee (by inputting Y), play

Tenzi (by inputting T), or quit (by inputting anything else). This prompt should continue

to be appear until the user quits. If the choice is Y, the user should be prompted to input

the number of trials to simulate for the Monte Carlo simulation and the number of dice

to use. The following should be printed to the shell:

Probability of Yahtzee with X dice: y.yyyy

where X is the number of dice which the user input, and y.yyyy is the probability of

getting a Yahtzee. Use four decimals for printing the probability. If the choice is T, the

user should be prompted to input the number of trials to simulate and the number of dice

to use. The following should be printed to the shell:

Rolls to get a Tenzi with X dice:

{1: Y, 2: Y, 3: Y, 4: Y, 5: Y, 6: Y, 7: Y, 8: Y, 9: Y, 10: Y, ’more than 10’ : Y}

where X is the number of dice which the user input, and the Y’s are the number of times

in the set of trials that it took that many rolls to get a Tenzi.

The following gives an example of running your code:

Note that the numbers you get may differ from these, but this should at least give a good

idea of what you should obtain from your code.

2

You’ll turn in a single Python program called yahtzee.py which includes the code given

above for simulating a dice roll, the main program as described above, and the following functions. Please be sure to include appropriate docstrings and comments for each

function.

• firstRoll : This should take an integer numDice as an input parameter which

tells how many dice you’re using in your game (this will be 5 for Yahtzee and 10

for Tenzi, but your function should be written for a general value for numDice),

and returns a list of length numDice of random integers each obtained by calling

rollDice. For example, the call

firstRoll(5)

will return a list such as

[2,4,1,6,4]

• newRoll : This should take the list diceList and an integer choice as input

parameters. Here diceList is a list of dice rolls, such as [2,4,1,6,4], and choice

is an integer corresponding to the dice value that you’re hoping to get a Yahtzee

with, such as 4. This should return a new list for which all dice which are not equal

to choice are re-rolled. For example, the call

newRoll([2,4,1,6,4],4)

will return a list such as

[4,4,3,4,4]

As in the example above, here the dice which was previously a 2 is now a 4, the

dice that was previously a 1 is now a 3, and the dice that was previously a 6 is now

a 4. The dice that were previously 4’s stay as 4’s.

• createDiceDict : This should take the list diceList as an input parameter, and

return a dictionary for which the keys are the possible roll values 1, 2, 3, 4, 5,

and 6, and the values are the number of times that roll value appears in the list.

For example, the call

createDiceDict([2,4,1,6,4])

will return the dictionary

{1:1, 2:1, 3:0, 4:2, 5:0, 6:1}

3

This captures that the value 1 appears once in the list, the value 2 appears once in

the list, the value 4 appears twice in the list, the value 6 appears once in the list,

and the values 3 and 5 don’t appear in the list.

• mostFrequent : This should take diceDict as an input parameter, which is a

dictionary as generated by the function createDiceDict. This should return the

highest dice value for which you have the largest number of matching dice. For

example, the call

mostFrequent({1:1, 2:1, 3:0, 4:2, 5:0, 6:1})

should return the value 4, because the dictionary encodes that the value 4 appeared

most frequently. Note that the call

mostFrequent({1:0, 2:2, 3:0, 4:2, 5:1, 6:0})

should also return the value 4, because we’re using the strategy that you always

try to get a Yahtzee with the highest dice value for which you have the largest

number of matching dice. This would be the dictionary corresponding to the list

[4,2,4,5,2].

• probabilityYahtzee : This should take integers numTrials and numDice as input

parameters. It will perform a Monte Carlo simulation of numTrials turns in which a

player tries to get all of the numDice dice to match. In each turn, the player will do a

first roll, a second roll if needed, and a third roll if needed. It should return the probability of getting all dice to match in one turn, calcuated from the Monte Carlo simulation. Note that in the game Yahtzee there are five dice, but your function should

be general enough to work for any positive integer value for numDice. Your function

should make calls to the functions firstRoll, newRoll, createDiceDict, and

mostFrequent as needed.

• rollsToGetTenzi : This should take integers numTrials and numDice as input

parameters. It will perform a simulation of numTrials trials to keep track of how

many rolls it takes in order for all of the numDice dice to match. It should return a dictionary whose keys are the numbers of rolls that this takes, specifically,

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and ’more than 10’, and whose values are the

number of times in the numTrials simulations that it took that many rolls. Note

here that if, in a given trial, after 10 rolls the dice do not all match, that trial

should be recorded as ’more than 10’. Note that in Tenzi there are ten dice, but

your function should be general enough to work for any positive integer value for

numDice. Your function should make calls to the functions firstRoll, newRoll,

createDiceDict, and mostFrequent as needed.

The functions firstRoll, newRoll, createDiceDict, and mostFrequent are worth 10

points each. The functions probabilityYahtzee and rollsToGetTenzi, and the main

program are worth 20 points each.

4

Academic Honesty Agreement

This project is open book, open notes. However, all work submitted must be your

own. By submitting these programs, you are asserting that all work on this project is

yours alone; that you did not use ChatGPT, Copilot, or similar AI bots; and that you

will not provide any information to anyone else working on the project. In addition, you

are agreeing that you will not discuss any part of this project with anyone. You are

not allowed to post any information about this project on the internet at any time, either

before or after the due date. Discussing any aspect of this project with anyone constitutes

a violation of the academic integrity agreement for CS8 and would result in an F in the

course.

Please note that you may ask questions about this project to the Professor, the TAs,

and the ULA’s, but we may answer in a limited way because we want to assess your

請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機打開當前頁
  • 上一篇:代做553.688 Computing for Applied 程序
  • 下一篇:CSCI1540代做、代寫C++設計編程
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發(fā)動機性能
    挖掘機濾芯提升發(fā)動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機亮相AWE 復古美學與現(xiàn)代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務 | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                美日韩一级片在线观看| 亚洲第一狼人社区| 欧美一级黄色片| 欧美一级免费大片| 欧美一区二区人人喊爽| 欧美白人最猛性xxxxx69交| 久久久久成人黄色影片| 国产精品萝li| 国产精品久久久久久福利一牛影视| 国产精品二三区| 香蕉成人啪国产精品视频综合网| 青青草一区二区三区| 久久99精品国产麻豆婷婷| 高清不卡在线观看| 色婷婷精品大在线视频| 日韩欧美国产综合一区| 中文字幕 久热精品 视频在线 | 1区2区3区精品视频| 亚洲一区二区三区不卡国产欧美| 国产精品成人网| 国产精品亚洲一区二区三区妖精 | 亚洲欧美激情在线| 五月天中文字幕一区二区| 成人性生交大片| 91精品国产综合久久精品麻豆 | 国产拍揄自揄精品视频麻豆| 久久蜜臀中文字幕| 一区二区三区在线免费| 精品写真视频在线观看 | 久久精品国产亚洲高清剧情介绍 | 在线日韩一区二区| 久久综合九色综合欧美就去吻| 综合激情网...| 国产乱一区二区| 日韩一区二区三区观看| 亚洲天堂2014| 国产美女一区二区| 91麻豆精品国产综合久久久久久 | 国产日产欧美一区二区三区| 五月婷婷激情综合| 99久久综合99久久综合网站| 久久新电视剧免费观看| 日韩av电影天堂| 欧美日韩免费电影| 一区二区三区四区蜜桃| 91尤物视频在线观看| 国产人妖乱国产精品人妖| 久久疯狂做爰流白浆xx| 欧美伦理电影网| 国产欧美一区二区三区网站| 精品国产一区二区国模嫣然| 午夜精彩视频在线观看不卡| 91视频.com| 久久久久久久久久久久久夜| 亚洲视频一区在线| 爽爽淫人综合网网站| 99久久99久久精品免费观看| 一区二区三区欧美亚洲| 久久精品国产久精国产| 欧美日本在线观看| 亚洲不卡在线观看| 欧美专区日韩专区| 亚洲国产成人av| 欧美日韩亚洲综合一区| 亚洲成人免费影院| 国产黑丝在线一区二区三区| 777久久久精品| av成人免费在线| 91在线观看高清| 亚洲欧美偷拍卡通变态| 欧美体内she精高潮| 一区二区三区欧美日韩| 日本黄色一区二区| 亚洲观看高清完整版在线观看| 免费的成人av| 色哟哟一区二区在线观看 | 国产日韩精品一区二区浪潮av| 欧美午夜理伦三级在线观看| 欧美一区二区视频免费观看| 国产成人aaa| 六月丁香综合在线视频| 免费三级欧美电影| 亚洲柠檬福利资源导航| 亚洲三级视频在线观看| 久久新电视剧免费观看| 国产精品综合视频| 国产在线精品不卡| 韩国女主播成人在线观看| 国产亚洲一本大道中文在线| 国产一区二区不卡老阿姨| 国产网红主播福利一区二区| 91免费视频网| 日本视频在线一区| 久久色在线观看| 日韩综合在线视频| 91超碰这里只有精品国产| 欧美一区二区三区在| 一区二区三区中文在线观看| 一区二区三区不卡视频在线观看| 国产精一区二区三区| 亚洲私人影院在线观看| 欧美一区二区三区在线| 三级精品在线观看| 欧美精品18+| 国产成人在线视频网址| 夜夜爽夜夜爽精品视频| 精品美女一区二区| 一本一本久久a久久精品综合麻豆| 日本大胆欧美人术艺术动态| 国产精品五月天| 91麻豆精品国产自产在线 | 午夜久久久久久电影| xf在线a精品一区二区视频网站| 一本一道久久a久久精品综合蜜臀| 蜜桃精品视频在线| 一区二区三区国产精华| 国产欧美一区二区精品性| 欧美顶级少妇做爰| 国产在线精品免费av| 精品国产a毛片| 99热99精品| 亚洲电影视频在线| 一区二区三区四区在线播放| 日韩电影在线一区| 亚洲免费色视频| 国产精品卡一卡二| 欧美军同video69gay| 亚洲高清中文字幕| 色综合久久久久| 美女在线视频一区| 欧美一区永久视频免费观看| 91亚洲大成网污www| 国产传媒久久文化传媒| 蜜臀国产一区二区三区在线播放| 亚洲影院理伦片| 亚洲乱码中文字幕综合| 中文字幕一区二区不卡| 国产欧美精品一区二区色综合 | 亚洲成人免费视频| 一区二区成人在线视频| 91精品国产美女浴室洗澡无遮挡| 一本一本大道香蕉久在线精品| 成人免费视频播放| 高清不卡在线观看| 美女一区二区视频| 中文字幕一区二区三区在线观看| 欧美年轻男男videosbes| 北条麻妃一区二区三区| 亚洲va欧美va天堂v国产综合| 久久久久久综合| 国产片一区二区三区| 久久毛片高清国产| 欧美激情综合在线| 国产精品大尺度| 亚洲精品免费在线| 中文字幕一区在线| 亚洲黄色片在线观看| 亚洲综合色成人| 国产精品久久久久9999吃药| 中文字幕一区二区三区不卡| 一区二区三区日韩| 日韩高清电影一区| 美女视频第一区二区三区免费观看网站| 亚洲免费在线播放| 国产精品高潮呻吟久久| 欧美刺激午夜性久久久久久久 | 亚洲乱码国产乱码精品精98午夜| 亚洲欧美日韩在线不卡| 亚洲一区在线观看免费观看电影高清 | 91精品国产综合久久精品图片| 欧美一区二区三区色| 久久免费偷拍视频| 中文字幕人成不卡一区| 亚洲综合成人网| 亚洲美女电影在线| 国产视频一区二区在线观看| 国产网站一区二区| 五月天婷婷综合| 一区二区三区国产精品| 1000精品久久久久久久久| 狠狠久久亚洲欧美| 大桥未久av一区二区三区中文| 99riav久久精品riav| 懂色av中文字幕一区二区三区| 91亚洲精华国产精华精华液| 欧美这里有精品| 欧美精品一区二区三区在线播放 | www.成人在线| 欧美日韩一区久久| 国产婷婷精品av在线| 亚洲一二三四在线| 亚洲激情男女视频| 国模无码大尺度一区二区三区| 国产一区二区伦理| 色呦呦网站一区| 欧美大片拔萝卜| 亚洲一区二区三区影院| 成人精品一区二区三区四区| 日本精品一区二区三区四区的功能| 99国内精品久久|