#include
#include
#include
#include
#include
using namespace std;
int GenerateDice();
int GenerateDirect();
int GetNextPos( int curPos,int direct,int dice);
int main()
{
int dice1,dice2,direct1,direct2,squa1=0,squa2=0,d1,d2,pos1,pos2;
srand(time(0));
cout
請(qǐng)達(dá)人幫我寫(xiě)一個(gè) silly board game 的程序
請(qǐng)達(dá)人幫我寫(xiě)一個(gè) silly board game 的程序
Nancy’s Silly board game is a spectator game and is based on luck.
1.The board has 25 squares numbered 1
to 25.
2.The first of two players to land on square/box number 25 wins the game.The players start off the
board (equivalent to position 0).
3.Each player rolls 2 dice which tells them the number of squares/boxes to move,and flips a coin to determine the direction in which they move:heads player moves forward,tails
player moves backwards.
比如:到了第23格,必須只能投出2點(diǎn)才能到打25,如果大于兩點(diǎn),保持不動(dòng),其他情況相同
在0格時(shí),如果硬幣投出反面,將保持不動(dòng),因?yàn)闆](méi)有負(fù)格
程序是這樣執(zhí)行的:
player1 is at box # 7(7) player2 is at box # 0(-12)
player1 is at box # 0(-8) player2 is at box # 0(-10)
player1 is at box # 0(-7) player2 is at box # 8(8)
player1 is at box # 7(7) player2 is at box # 1(-7)
player1 is at box # 0(-7) player2 is at box # 0(-8)
player1 is at box # 10(10) player2 is at box # 0(-4)
player1 is at box # 17(7) player2 is at box # 0(-12)
player1 is at box # 25(8) *** winner!
player1 is at square #25
player2 is at square #0
題目要求需要用function
即硬幣正反面,和兩個(gè)篩子的總數(shù)都要用function
Nancy’s Silly board game is a spectator game and is based on luck.
1.The board has 25 squares numbered 1
to 25.
2.The first of two players to land on square/box number 25 wins the game.The players start off the
board (equivalent to position 0).
3.Each player rolls 2 dice which tells them the number of squares/boxes to move,and flips a coin to determine the direction in which they move:heads player moves forward,tails
player moves backwards.
比如:到了第23格,必須只能投出2點(diǎn)才能到打25,如果大于兩點(diǎn),保持不動(dòng),其他情況相同
在0格時(shí),如果硬幣投出反面,將保持不動(dòng),因?yàn)闆](méi)有負(fù)格
程序是這樣執(zhí)行的:
player1 is at box # 7(7) player2 is at box # 0(-12)
player1 is at box # 0(-8) player2 is at box # 0(-10)
player1 is at box # 0(-7) player2 is at box # 8(8)
player1 is at box # 7(7) player2 is at box # 1(-7)
player1 is at box # 0(-7) player2 is at box # 0(-8)
player1 is at box # 10(10) player2 is at box # 0(-4)
player1 is at box # 17(7) player2 is at box # 0(-12)
player1 is at box # 25(8) *** winner!
player1 is at square #25
player2 is at square #0
題目要求需要用function
即硬幣正反面,和兩個(gè)篩子的總數(shù)都要用function
其他人氣:744 ℃時(shí)間:2020-05-21 03:16:42
優(yōu)質(zhì)解答
我來(lái)回答
類(lèi)似推薦
- Light as a Feather Stiff as a Board game(是什么意思)
- 桌游board game英文簡(jiǎn)介
- 將notice tape computer和board game recorder配對(duì),再翻譯過(guò)來(lái)
- 表演者取出一裝滿(mǎn)水的飲料瓶,旋開(kāi)瓶蓋,水卻從瓶底流出的真相(用物理知識(shí)回答)
- 求一/二階微分方程通解
- 把這句話(huà)改為比喻句:我的心很疼痛,很難受.如題
- 兩分鐘英語(yǔ)對(duì)話(huà),兩人的,一共十來(lái)句就行,新穎點(diǎn)的,不簡(jiǎn)單也不難,
- who can tell me?thanks alot.
- My mother works for 8__________(huor)a day
- 碳酸鈉與水二氧化碳反應(yīng)方程式:Na2CO3+CO2+H2O=2NaHCO3這個(gè)反應(yīng)方程式有離子方程式
- 科學(xué)家指2019年2月1日地球可能末日
- 山民 閱讀題
猜你喜歡
- 1關(guān)于虛擬語(yǔ)氣的一個(gè)問(wèn)題!if條件句,表示與將來(lái)事實(shí)相反時(shí),從句謂語(yǔ)是過(guò)去時(shí)或should do
- 2分子間都存在范德華力嗎
- 3出租車(chē):乘車(chē)不超過(guò)3千米時(shí),收費(fèi)5元(起步價(jià))超過(guò)部分每千米加收1.5元.王叔叔乘車(chē)15千米,
- 4幼兒園阿姨給小朋友分糖,如果每個(gè)小朋友分6顆,還多18顆糖,如果每個(gè)小朋友分9顆,就差8顆
- 5在三角形ABC中,CE平分角ACB,AC=8cm,AB=12cm,BC=10cm,過(guò)B作BD平行于CE,求BD的長(zhǎng).
- 6大自然的作文 300字
- 7We left the classroom after we finished the homework.(改成同義句) we___ ____ the classroom _____.
- 8AB是圓O的直徑,PA垂直于圓O所在的平面,C是圓周上的任意一點(diǎn),求證:BC⊥面PAC
- 9奧運(yùn)會(huì)幾年一次
- 10So 15 bottles of beer should be enough.
- 11I am gIad to learn that you wiIl coming to China.
- 12we watch TV at home改一般疑問(wèn)句并做否定回答