加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

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

代寫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

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

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)/客戶要求/設(shè)計優(yōu)化
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計優(yōu)化
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計優(yōu)化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發(fā)動機性能
    挖掘機濾芯提升發(fā)動機性能
    海信羅馬假日洗衣機亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網(wǎng) 排行網(wǎng)

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

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

    麻豆国产精品一区二区三区 | 国产精品久久久久久麻豆一区软件| 国产最新精品| 日本欧美一区| 老牛影视一区二区三区| 欧美91在线| 日韩伦理一区二区三区| 欧美亚洲在线| 午夜不卡影院| 天使萌一区二区三区免费观看| 欧美成人基地| 日韩精品免费视频一区二区三区| 一区二区毛片| 亚洲日本网址| 久久不射网站| 偷拍欧美精品| 视频福利一区| 婷婷综合国产| 欧美精美视频| 中文字幕日韩欧美精品高清在线| 国产精成人品2018| 成年男女免费视频网站不卡| 女人香蕉久久**毛片精品| 中文字幕av一区二区三区人| 亚洲丝袜啪啪| 国产精品视频一区二区三区综合| 一区二区黄色| 亚州欧美在线| 丝袜诱惑一区二区| 欧美韩国日本在线观看| 一区在线免费| 亚洲精品在线观看91| 日韩精品一区二区三区免费观影 | 美女视频网站久久| www.久久.com| 日韩欧美字幕| 日本不卡1234视频| 国产极品在线观看| 日本久久一二三四| 视频在线观看91| 在线综合亚洲| 狠狠爱成人网| 一本久久知道综合久久| 91久久电影| 天天超碰亚洲| 国产综合网站| 女主播福利一区| 黄色综合网站| 亚洲一区图片| 蜜臀av性久久久久蜜臀aⅴ流畅 | 精品深夜福利视频| 国产精品对白| 久久久久久久久国产一区| 红杏视频成人| 91精品一区国产高清在线gif| 欧美sss在线视频| 欧美成a人免费观看久久| 久久天堂精品| 久久国产亚洲| 欧美军人男男激情gay| 成人短片线上看| 午夜在线精品| 欧美国产美女| 色综合天天色| 裸体一区二区三区| 亚洲人体av| 亚洲区小说区| 北条麻妃一区二区三区在线| 美日韩黄色大片| 欧美大片aaaa| 先锋影音国产一区| 91亚洲国产成人久久精品| 神马午夜在线视频| 欧美成人一二区| 91九色成人| 精品视频在线观看网站| 国产精品男女| 欧洲美女日日| 爽好多水快深点欧美视频| 中文字幕人成乱码在线观看| 国产精品4hu.www| 国产精品久久久久久久久久久久久久久| 国产欧美日韩视频在线| 亚洲国产中文在线| 欧美在线色图| 水蜜桃精品av一区二区| 日本国产欧美| 国产成人免费av一区二区午夜| 美女精品视频在线| 免费欧美一区| 国产网站在线| 国产欧美日韩亚洲一区二区三区| 亚洲字幕久久| 国产精品色在线网站| 黄色工厂这里只有精品| 人人草在线视频| 欧美激情精品久久久六区热门| 日本一区二区三区视频在线看| 天堂资源在线亚洲| 爽成人777777婷婷| 日韩高清欧美激情| 免费精品一区二区三区在线观看| 婷婷综合视频| av免费在线一区| 综合亚洲色图| 国产在线不卡| 视频在线日韩| 欧美日韩123| 欧美 日韩 国产 一区| 中文字幕高清在线播放| 欧美精品99| 欧美一二区在线观看| 97精品国产| 亚洲综合专区| 欧美a级一区| 欧美日韩精品免费观看视欧美高清免费大片 | 欧美国产精品| 成人性生交大片免费看96| 欧美久久综合网| 日韩三区免费| 婷婷视频一区二区三区| 亚洲专区免费| 日本欧美韩国一区三区| 精品九九在线| 伊伊综合在线| 日韩av二区在线播放| 日韩亚洲在线| 午夜天堂精品久久久久| 欧美 亚欧 日韩视频在线 | 福利片一区二区| 91嫩草亚洲精品| 国产一区2区| 美女精品在线| 欧美影院精品| 最新日韩av| 亚洲最新色图| 日韩视频一区| 一区二区三区午夜探花| 欧美日韩hd| 久久影院资源站| 一区二区亚洲精品| 欧美激情视频一区二区三区免费| 亚洲欧美综合| 在线国产欧美| 日韩午夜一区| 欧美日本三级| 日韩av有码| 久久伊人精品| 日韩大片免费观看| 国产成人aa在线观看网站站| 91免费精品| 欧美涩涩视频| 亚洲黑人在线| 竹菊久久久久久久| 日本视频中文字幕一区二区三区| 激情六月综合| 欧美黄色一区二区| 亚洲一区欧美激情| 日韩二区在线观看| 成人欧美一区二区三区的电影| 伊人精品综合| 日韩午夜视频在线| 欧美日韩国产在线观看网站| 国产精品mm| 免费视频一区二区| 欧美日韩网站| 免费一级欧美片在线播放| 狠狠色综合网| 日韩激情毛片| 久久xxx视频| 午夜日韩激情| 日韩电影在线一区| 日韩精品一页| 一本色道久久综合亚洲精品高清 | 亚洲图色一区二区三区| 日韩三级成人| 伊人久久久大香线蕉综合直播| 日韩精选在线| 不卡亚洲精品| 国产亚洲欧洲| 亚洲精品a区| 亚洲国产日韩在线| 免费成人av资源网| 亚洲成人精品| 久久99青青| 欧美成人三级| 蜜桃视频在线一区| 里番精品3d一二三区| а天堂中文最新一区二区三区| 亚洲综合电影| 91超碰国产精品| 日韩视频1区| 日韩精品福利网| 国产污视频在线播放| 亚洲第一网站| 日韩一区二区三区精品| 日韩和欧美一区二区三区| 色综合久久网| 亚洲黄网站黄| 欧美成人基地|