dsbj90 / BullsAndCows

猜数字(又称 Bulls and Cows )小游戏。A little game called Bulls and Cows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BullsAndCows

猜数字(又称 Bulls and Cows )小游戏。 A little game called Bulls and Cows.

一下午的自娱自乐之作。 编程练习。

游戏规则:

Hello!我是猜数字(又称 Bulls and Cows )小游戏!

游戏的开始,我会出一个4位数,这4个数没有重复,在0~9之间,然后就到你的柯南时间啦!

你给我4个数后,我会回答你 × A × B,A前面的数字表示位置正确的数的个数,而B前的数字表示数字正确而位置不对的数的个数……

有点晕?等等啊,我们举个栗子啊: 如果正确答案为 5234,而你猜 5346,则是 1A2B,其中有一个5的位置对了,记为1A,而3和4这两个数字对了,而位置没对,因此记为 2B,合起来就是 1A2B。

============

如果猜不出来,可按“q”键放弃。 据说正常人一般8次左右就能猜中呢……

2014-6-9

About

猜数字(又称 Bulls and Cows )小游戏。A little game called Bulls and Cows.