1 Star 0 Fork 0

shoupt / 五子棋

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or Download
Notice: Creating folder will generate an empty file .keep, because not support in Git


My Gobang


This repository is used to develop a game project,named My Gobang.

This is the second online generation on LAN(local area network), which support you play it with another guy on two computers after the same LAN such as same wifi.

Oh, this software can only run on computer! So don't do the operations on your phone.



Update Background

There are too much unnecessary methods in server.py and client.py of version 2.0:
And besides, there is a more than that in server.py, uniform_progress.
Actually the first three methods were in chess.py. Server and client do these again just because all these methods do need to send messages to the other side. So we can solve this problem by integrating these functions into chess.py. After that, server and client just need to get a class, which inherit chess, and reset the send method, then they can exchange messages.

Update Operations

  1. Update in chess.py:
    ①send(): is used to send messages.
    must be overide after inherited
    This method was invoked in methods for add chess, take back a move, play a new game. So server.py and client.py can be simplified much more. Users don't need to overide these four functional methods again, they just need to get a class inheriting chess and overide "send" method, then they can exchange messages. ②messagebox():provided a bubble window which you can appoint message content, title, location and how long to display.
    Bubble window means this window will appear and disappear automatically.
    This method help us solve the bug on version 2.0: When the window appearing, you have to click the button to get into the next step normally.
    ③pop_window():provided a bubble window to prompt messages.
    Of course you can also indicate how long to appear still, although default value is one second. ④close_window():do solve the bug(click q to quit game but the window is still there) of previous versions.
    These below method is perhaps need to be overide when you inherit chess
    ①uniform_progress():provided to solve the bug of version 2.0, which bug is the progress was different after play a new game.
    ②send_add_chess():send message for add chess, and send your absolute location(dx,dy) to the other side.
    ③send_rechess():send message for a new game.
    ④send_undo():send message for taking back a move.
    This below method is must be overide when you inherit chess
    send_quit():send message for "I'm quit".
    Considering there is a operation to release resources, it must be overide.
    The above five method are used to uniform the message format, you can overide them when you need to change the format
  2. The bug solved in server.py and client.py is:
    Our pc will not do anything when the other side disconnect exceptionally.

Software Architecture

This is an software running with python, which means there must be support of python3 on you pc. On that, we suggest you to install python with version 3.6 or plus.


  1. Install python3.6+. If you don't know how to install python, then find it in baidu or google.
  2. download this source:
    method 1:
    go into this page in your browser:
    click the button:"克隆/下载"
    click the button:"下载zip"
    method 2:
    if you are professional on this field, you can use this way:
git clone git@gitee.com:shoupt/gobang.git


  1. Version:
    Single PC : run chess.py
    Online: run server.py on master pc, and run client.py on slave pc.
  2. After running the master pc, log the ip address on the pop up window on master pc, input the address on the enter window on slave pc, then the connection between master and slave is built.
  3. mouse button:
    Version Single PC:
    left: add black chesspiece
    right: and white chesspiece
    Online Version:
    left: add chess. Server is the black side.
  4. keyboard operation:
    u: take back a move
    r: play a new game
    q: quit the game

Functional description

  1. It can judge winner. You can be the winner if you have a serial of five chesspiece on any just one direction on horizontal or vertical or oblique direction. It means there cannot be other chesspiece break on that line in your five.
  2. You can click the buttons to make choice after any player of the white or black side:
    再来一局:reset the chess board so you can play a new game.
    观赏棋局:don't do anything, just enjoy the sight of it.
  3. If you want a new game after clicking the button named "观赏棋局", then click mouse button on the chess board. There will be two button to make choice:
    是:yes, play a new game
    还是不了:no, i want to enjoy it
  4. You can make some operations with keyboard, you can find the details on Instructions.
  5. Stipulate any player have to wait the other side then you can add chess again.


  1. Fork the repository
  2. Create Feat_xxx branch
  3. Commit your code
  4. Create Pull Request

Repository Comments ( 0 )

Sign in to post a comment


本仓库用于开发一个五子棋游戏项目 expand collapse

Releases (1)





Load More
can not load any more


161121 f78d6d6f 1850385 154831 86f8c370 1850385