请达人帮我写一个 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 st
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/23 19:06:17
![请达人帮我写一个 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 st](/uploads/image/z/3215122-34-2.jpg?t=%E8%AF%B7%E8%BE%BE%E4%BA%BA%E5%B8%AE%E6%88%91%E5%86%99%E4%B8%80%E4%B8%AA+silly+board+game+%E7%9A%84%E7%A8%8B%E5%BA%8FNancy%E2%80%99s+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%2Fbox+number+25+wins+the+game.The+players+st)
请达人帮我写一个 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 st
请达人帮我写一个 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点才能到打25,如果大于两点,保持不动,其他情况相同
在0格时,如果硬币投出反面,将保持不动,因为没有负格
程序是这样执行的:
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
即硬币正反面,和两个筛子的总数都要用function
请达人帮我写一个 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 st
#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