Let's make Othello with wxPython

Introduction

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 **

wxPython installation

LinuxMint, Ubuntu, Debian

$sudo apt-get install python-wxgtk2.8

For Windows

Operation check environment

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. .. ..

how to play

screen_shot.png 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.

Supplement

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.

reference

Python-izm

Recommended Posts

Let's make Othello with wxPython
Let's make a breakout with wxPython
Let's make Othello AI with Chainer-Part 1-
Let's make Othello AI with Chainer-Part 2-
Let's make dice with tkinter
Let's make a GUI with python.
Let's make a graph with python! !!
Let's make a supercomputer with xCAT
Let's make a shiritori game with Python
Let's make a voice slowly with Python
Let's make a simple language with PLY 1
[Python] Let's make matplotlib compatible with Japanese
Let's make a web framework with Python! (1)
Let's make a tic-tac-toe AI with Pylearn 2
Let's make a Twitter Bot with Python!
Let's make a web framework with Python! (2)
Let's replace UWSC with Python (5) Let's make a Robot
Make Lambda Layers with Lambda
Make Yubaba with Discord.py
Play with Othello (Reversi)
Make slides with iPython
[Let's play with Python] Make a household account book
Let's make a simple game with Python 3 and iPhone
Let's make dependency management with pip a little easier
Let's make a Mac app with Tkinter and py2app
Let's make a spherical grid with Rhinoceros / Grasshopper / GHPython
[Super easy] Let's make a LINE BOT with Python.
Let's make a websocket client with Python. (Access token authentication)
Let's play with 4D 4th
Let's make a Discord Bot.
Let's play with Amedas data-Part 1
Make sci-fi-like buttons with Kivy
Let's run Excel with Python
Let's make an Errbot plugin
Let's play with Amedas data-Part 4
Easy to make with syntax
Make Puyo Puyo AI with Python
Let's make Splatoon AI! part.1
Make a fortune with Python
Let's write python with cinema4d.
Let's do R-CNN with Sklearn-theano
Make HTTPS for free with Amazon Linux2 + Freenom + Let's Encrypt
Let's play with Amedas data-Part 3
Let's play with Amedas data-Part 2
Let's make a rock-paper-scissors game
Let's build git-cat with Python
Othello made with python (GUI-like)
Let's make a diagram that can be clicked with IPython
Make a fire with kdeplot
Make Slack chatbot with Errbot
Let's make a WEB application for phone book with flask Part 1
Let's make a cycle computer with Raspberry Pi Zero (W, WH)
Let's make a WEB application for phone book with flask Part 2
Let's make a WEB application for phone book with flask Part 3
Let's make a WEB application for phone book with flask Part 4
Let's make a web chat using WebSocket with AWS serverless (Python)!
Let's make an IoT shirt with Lambda, Kinesis, Raspberry Pi [Part 1]
Let's make a remote rumba [Hardware]
Let's execute commands regularly with cron!
Let's upload S3 files with CLI
Make Echolalia LINEbot with Python + heroku