Released:
Put your strategic thinking to the test when you play chess online with friends, random opponents or against computer. Free online multiplayer board games – no download and no registration required. At the top is the reversi.py file which contains the common 'main' function which starts the application. This takes care of parsing command line arguments and constructing the Game object which handles the game specific parts of the application. The Game class exists inside the game/game.py file.
A version of the Reversi board game intended for casual play.
Project description
An implementation of the popular Reversi board game, for use by one or twoplayers. Some simple AI is included to provide a computer opponent, and if youare feeling lazy you can watch while two AI opponents slug it out.
Installation
For Version 1.2, supported platforms are Linux and now Windows (tested on Win7),although in theory this game should play equally well on Mac. I would like tohear from anyone who can help with porting (I don't have a Mac, or a Mac OS tohand).
Installation (Linux):
Ensure all dependencies are installed. In particular, make sure you havea version of python >= 3.2, with the numpypackage installed.
Unzip the tar.gz somewhere.
In a console window navigate to the Reversi-1.2 directory and run thefollowing command as root (on Ubuntu/Debian use sudo):
[sudo] python3 setup.py install
On Ubuntu a desktop launcher is installed, which you should be able tofind in the Dash and drag to the launcher bar. The default assumes youare using python 3.2. If this is not the case you will need to manuallytweak the path references in the .desktop file.
Installation (Windows):
Ensure all dependencies are installed. In particular, make sure you havea version of python >= 3.2, and numpy. The easiest way to do this onWindows is to install WinPythonfor your system, because (in addition to numpy) loads of commonly-usedpackages are bundled with python ready to use.
Extract the tar.gz somewhere (7-Zip should work).
Navigate into the dist directory and extract the Reversi-1.2.zip file.
In a console window navigate to the Reversi-1.2 directory and run thefollowing command:
[path_to_python]python setup.py install
A .bat launch script is installed in the public desktop. This shouldwork on both XP and Win 7/8 systems, but the path references may needto be edited for your flavour of python installation. The defaultassumes WinPython 3.3.2.3 for amd64 (see note above).
Released:
Put your strategic thinking to the test when you play chess online with friends, random opponents or against computer. Free online multiplayer board games – no download and no registration required. At the top is the reversi.py file which contains the common 'main' function which starts the application. This takes care of parsing command line arguments and constructing the Game object which handles the game specific parts of the application. The Game class exists inside the game/game.py file.
A version of the Reversi board game intended for casual play.
Project description
An implementation of the popular Reversi board game, for use by one or twoplayers. Some simple AI is included to provide a computer opponent, and if youare feeling lazy you can watch while two AI opponents slug it out.
Installation
For Version 1.2, supported platforms are Linux and now Windows (tested on Win7),although in theory this game should play equally well on Mac. I would like tohear from anyone who can help with porting (I don't have a Mac, or a Mac OS tohand).
Installation (Linux):
Ensure all dependencies are installed. In particular, make sure you havea version of python >= 3.2, with the numpypackage installed.
Unzip the tar.gz somewhere.
In a console window navigate to the Reversi-1.2 directory and run thefollowing command as root (on Ubuntu/Debian use sudo):
[sudo] python3 setup.py install
On Ubuntu a desktop launcher is installed, which you should be able tofind in the Dash and drag to the launcher bar. The default assumes youare using python 3.2. If this is not the case you will need to manuallytweak the path references in the .desktop file.
Installation (Windows):
Ensure all dependencies are installed. In particular, make sure you havea version of python >= 3.2, and numpy. The easiest way to do this onWindows is to install WinPythonfor your system, because (in addition to numpy) loads of commonly-usedpackages are bundled with python ready to use.
Extract the tar.gz somewhere (7-Zip should work).
Navigate into the dist directory and extract the Reversi-1.2.zip file.
In a console window navigate to the Reversi-1.2 directory and run thefollowing command:
[path_to_python]python setup.py install
A .bat launch script is installed in the public desktop. This shouldwork on both XP and Win 7/8 systems, but the path references may needto be edited for your flavour of python installation. The defaultassumes WinPython 3.3.2.3 for amd64 (see note above).
Controls
The controls for the game are minimal, and hopefully self-explanatory, but hereis a list:
Preparation Controls:
A selection box appears to enable the player to choose theirpreferred language.
If no language is selected the game will default to English.
Four modes are supported:
- Normal (human versus computer opponent).
- Person versus Person, in ‘hot-seat' mode.
- Computer versus computer, what I like to call TV mode.
- Benchmarking mode, all graphics turned off. In this modeadditional information is requested for the number of gamesto play.
The default mode is ‘Normal'.
Game Play Controls:
Forest fire (nicole polidore) mac os. Who starts is chosen at random.
Reverse Macros
You can elect to play again as many times as you want. The moregames you play, your game statistics will be accumulated anddisplayed on the scoreboard.
At the time of writing, there is no mechanism for storing gamestatistics between sessions, so if you want to save your high-scores youwill have to resort to a screen-shot!
Choice of UI: Console vs. Tkinter/ttk
The game has been shipped ‘hard-wired' for the tkinter/ttk interface. For mostpurposes this is (I believe) a nice and easy interface to use. However,particularly if you want to do a lot of bench-testing of different AI, you maywish to use the console interface instead. This is very easy do in the sourcecode, just un-comment the console interface and comment the tkinter interface inthe heading of the ui module.
An older version of the game also had a pygame interface, but this has beenremoved in the shipped version. There are several reasons for this:
At the time of writing, installing pygame for Python 3 is stillsomething of a black art. It was felt that the difficulty of installingpygame outweighs any advantages of using it for a simple board game forend users.
Removing the pygame interface makes the packaging simpler (OK, so I'mlazy).
For a board game, the sophisticated handling of sprites (pygame's greatstrength) is not required. Tkinter/ttk offers instead a very good set ofthemed widgets with excellent hooks for callouts, making the ui veryeasy to write, and much nicer to use, than is possible with the graphicsof pygame.
At the time of writing, pygame does not support unicode. This means thati18n with languages like, for example, Chinese, is not possible in apygame interface using the Python i18n package. You just end up with aload of rectangular boxes on the screen. i18n with pygame is stillpossible, but it would require a lot of code, and the use of a lot ofgraphic images instead of text. As noted above, I am lazy.
sigh Why, in this day and age, is software being written that does notsupport unicode (expecially when that is one of the strengths of thelanguage it is written in)?
Some history:
This implementation of Reversi is very loosely based on the Reversi gamedescribed in the book Invent Your Own Computer Games With Python by ‘AlSweigart '_. While some of the algorithms maystill be recognisable, this code has been designed from scratch from an objectmodel rather than using the functional programming flow diagram approach.
Originally implemented with a console UI, the code was adapted to work withboth pygame and tkinter/ttk graphics. However, due to lack of support in pygamefor unicode, the pygame interface was dropped to enable i18n (see above for thepolemic).
I have had a lot of fun designing some more intelligent AI for the moredemanding player, although I expect this still falls well belowtournament standard. Nevertheless, the result is more pleasing to my eye, andhopefully more bug-free and maintainable. The AI is designed to be pluggable, soit should be relatively easy to create new algorithms and implement them infuture versions.
As you might have guessed from the citation above, my original motive forwriting this was to learn Python. However, as I went along the project became avehicle for learning a lot of other associated Pythonic stuff.
This little game introduced me to Pygame and NumPy, and then tkinter/ttk.In the later stages I found out how to use the i18n module forinternationalization.
This project has been an opportunity for me to (re-)learn Eclipse, and anintroduction to NetBeans. I have also looked at some other IDEs aimedspecifically at Python, but I have not (yet) found one that will stay alive longenough to type ‘Hello World!'.
I have also found out a lot I never wanted to know about CVS, and a lot I amvery grateful to have discovered about Mercurial.
I have used this little piece of code to find out more aboutdistributing Python software. If you are reading this, you will know I havesucceeded :).
Finally, because I don't allow Windows computers in the house, I have learnedone heck of a lot about using VirtualBox while I was testing/debugging theWindows installation. I also re-discovered why I hate Windows…
Languages
At time of writing the only options supported are English, French and Chinese,but if there is someone ‘out there' interested in helping with othertranslations I will be happy to hear from them.
I would also be grateful for any help with my rusty French and ‘GoogleTranslate' Chinese :).
Project details
Reversi Mac Os Catalina
Release historyRelease notifications | RSS feed
1.2.1
1.2
1.1
1.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size Reversi-1.2.1.tar.gz (49.7 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for Reversi-1.2.1.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | 1b5fcb7906ac93126e59dbee3422b8add2342409521de3ae8a7f9be5195b2049 |
MD5 | 6b83e139deb57750b6a825434e6b5f62 |
BLAKE2-256 | 7727f4ae815c61390111e02ee628de0b4fee39f7ba2d26855e601e10b71e2a58 |