If you want to program but don't know what to make, why not start by making a simple game? This time, I will create Othello using wxPython, which allows you to easily create a multi-platform GUI application. Inspired by this article, I hope you will make Minesweeper and Gomoku. The source is posted on GitHub, so please get it from there. ** 2016/6/10: Bug fixed. Get the latest version of the master branch **
LinuxMint, Ubuntu, Debian
$sudo apt-get install python-wxgtk2.8
For Windows
Install python 2.7.11. Download the binaries from python.org here and install python2.7.11. Select 32bit / 64bit according to your environment.
Install wxPython Then download and install the binaries for python2.7 from here wxpython.org. Match 32bit / 64bit with python2.7.11 installed earlier.
I think wxpython will work with 2.8 as well. It is possible to play on Windows 10, but the display is broken, probably because BoxSizer is not working properly. .. ..
Select Game mode and press START to play. The first attack is always black.
Place the stone with the left mouse click. Do not use the middle mouse button click as it is for debugging.
You may find it better to look at the real rather than explain the source code, but only one. If you want to create your own computer AI, please implement it in the following location. Currently, you can use "List of places where you can put stones (pos_list)" and "List of the number of stones you can get when you put stones in that place (gain_list)" at the time of implementation. The current AI is also called AI, and it is said that it will be placed in the place where the stone is first found.
def decideComputerNext(self, pos_list, gain_list):
print ("pos_list :" + str(pos_list))
print ("gain_list:" + str(gain_list))
# Insert a computer's AI here
next_pos = pos_list[0]
return next_pos
Please create a strong AI yourself and fight with your friends. If one uses Man vs Computer and the other uses Computer vs Man, each computer AI can compete with each other. (Enter each other's hand as Man's hand)
By the way, you may be wondering why there is a Game mode called Computer vs Computer, but don't worry too much. For the time being, you can realize the battle between your own AIs.
Recommended Posts