首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Python > 一个经典的纸牌游戏,战争游戏。

一个经典的纸牌游戏,战争游戏。

资 源 简 介

This program was written with copious comments to illustrate some aspects of Python that may help the beginner with the language. The nominal purpose of the program is to have the computer play the card game of war against itself. The program is called class-warfare because I"ve tried to use object-oriented methods wherever possible. An interesting phenomenon was discovered during the writing of this program: if the cards captured by the victor are returned to the winner"s hand without being shuffled, there is a chance that the game will devolve into an infinite loop. There are two command line options that can demonstrate this. If the program is run with these options: $ ./class-warfare-v2.0.py -s -f The program will bail after 5000 rounds as it is most likely headed into an infinite loop. The -s option directs the program to use a simplified deck. The -f option directs the program to not shuffle the spoils (the captured cards) as they are
VIP VIP
0.188230s