无兄弟不篮球,篮球场上的"斗牛"大家应该特别喜欢吧!
前几天,玩一款“斗牛”的扑克牌游戏,自己就试着”玩“了一下。
//上述代码是总的大概代码。
个人觉得代码写得实在是太冗余了,太长了,而且看上去好烦的感觉。这只是脑子里的第一个思路想法就立马写出来了。比如开始用if-else,后来换成switch-case,这样可读性好了许多,仅仅只将其两个写成了方法,可能还远远不够,面向对象还在领悟中......
前几天,玩一款“斗牛”的扑克牌游戏,自己就试着”玩“了一下。
//上述代码是总的大概代码。
//上述代码是随机产生五张扑克牌的数字。
//上述代码是将五个数字,传给方法JudgeCattle(),有牛返回剩下两个数字的和,没牛返回-1。
//上述代码是判别?没牛的输出没牛,有牛的输出是牛几。
//另外两种情况:炸弹和AAABB类型的暂时还没想到怎么去实现?希望大家补充!个人觉得代码写得实在是太冗余了,太长了,而且看上去好烦的感觉。这只是脑子里的第一个思路想法就立马写出来了。比如开始用if-else,后来换成switch-case,这样可读性好了许多,仅仅只将其两个写成了方法,可能还远远不够,面向对象还在领悟中......
附上代码”斗牛“游戏
备注:写于2013年2月4日