请达人帮我写一个 silly board game 的程序
题目
请达人帮我写一个 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)
答案
#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
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
- 【宾语从句】作业题改几个宾语从句,宾语从句的格式
- 求证4个连续奇数中,中间两个数的积比前后两个的积大8
- 有5张卡,分别写着数字1,2,4,5,8现从中取出3张卡,并排放在一起组成一个三位数如152.可组成多少不同偶数
- 英语翻译
- 去博物馆的路怎么走 用英语怎么说
- 已知aa-ab-bb=-3/4,aa-ab+2bb=-2/3,求b的值
- 唐朝商业繁荣的原因
- 写三八妇女节给妈妈的话500字
- 在同一天晚上月亮的位置是怎样变化的?
- 英语翻译
热门考点