这是一个创建于 4174 天前的主题,其中的信息可能已经有所发展或是发生改变。
0 — rock
1 — Spock
2 — paper
3 — lizard
4 — scissors
剪子剪布;
布包石头;
石头砸蜥蜴;
蜥蜴毒死史巴克;
史巴克踩碎剪子;
剪子斩首蜥蜴;
蜥蜴吃掉布;
布(纸,英语中与论文同词)证明史巴克不存在;
史巴克融化石头;
石头敲坏剪子。
程序:
电脑产生一个(0-4)随机数,
函数接受一个参数,eg:"paper",这个参数也转化成一个数字,
2个数怎么判断输赢
#项目的提示是:
# compute difference of player_number and comp_number modulo five
这句话看不懂,问了一些有程序基础的人也不知道。
我的项目代码:http://www.codeskulptor.org/#user10_eVfpXcdah4_1.py
5 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
skywalker 2013-04-24 11:52:39 +08:00
player_number和comp_number的差值对5取模啊
|
|
|
3
chyiz 2013-04-24 12:08:23 +08:00
@ coolicer 这个游戏的规则就是把5个数连成圈,每个数都赢它前两个,输给它后两个啊,所以就用取模咯。
|
|
|
4
ctrlaltdeletel 2013-04-24 12:14:38 +08:00
每个东西都是克制前面两个、被后面两个克制啊 做差+5取模,判断是1、2, 还是3、4 就能判断输赢了吧 要是0就是同一个东西吧
|
|
|
5
coolicer 2013-04-24 12:22:18 +08:00
我懂了
|