Skip to content

OliviaWYQ/Gomoku-Desktop

Repository files navigation

Alpha Gomoku Game

In this project, we implement a Gomoku game software, which has two modes: game between two people and rivalry between Human and Artifactual Intelligence. The client and user interface are implemented using Python and the server side is implemented using Java. To develop further, We apply algorithms with three difficulties in the application to enhance the wisdom of AI chess player.

Video Guide in YouTube

Download Alpha Gomoku Game for macOS

Getting Start

Prerequisites

Python 3.6 installed in client and Oracle JDK8 (java-8-oracle) with Maven installed in server.

pip install --upgrade pip
pip install -r requirements.txt

Installing

To see which version of Python you have installed:

$ python --version

To install python3.6 on Ubuntu:

$ sudo apt-get update
$ sudo apt-get install python3.6

Oracle JDK 8 is the latest stable version of Java at time of writing. You can install it on Ubuntu using the following command:

$ sudo apt-get install oracle-java8-installer

You can verify your Java version:

$ javac -version

There can be multiple Java installations on one server. You can manage Java JDK version:

$ sudo update-alternatives --config java
Setting the JAVA_HOME Environment Variable:

Open .bashrc or /etc/profile to manage $PATH:

$ vi ~.bashrc

or

$ sudo vi /etc/profile

Add JAVA_HOME:

export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVAHOME/lib/tools.jar

Make the changes in $PATH work:

$ source ~.bashrc

or

$ source /etc/profile

Install Maven

Apache Maven is a software project management and comprehension tool. To install the latest Apache Maven:

$ sudo apt-get install maven

Setting MAVEN_HOME Environment Variable

Open .bashrc or /etc/profile:

export MAVEN_HOME="/usr/share/maven"
export PATH=${PATH}:${MAVEN_HOME}/bin

To verify your installation:

$ mvn -version

Install Spring Boot

We use Spring framework to deploy MongoDB and Redis.

Download installation package:

wget http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.0.6.RELEASE/spring-boot-cli-2.0.6.RELEASE-bin.tar.gz

Decompress the .tar.gz package:

tar -zxvf spring-boot-cli-2.0.6.RELEASE-bin.tar.gz

Add PATH to .bashrc or /etc/profile:

export PATH=${PATH}:~/spring-2.0.6.RELEASE/bin

Verify the version of Spring framework:

spring --version

Running the Program

Server:

Get to the server folder and use Maven to compile and package Java program:

$ cd server/
$ mvn clean
$ mvn compile
$ mvn package

Run server:

java -jar <jarfilename>.jar

Client:

Get to the client folder:

$ cd client/

Run Python program:

$ make
$ make run

Enter the username, password and IPv4 of server, or sign up a new account.

We use PyQt5 to build the UI, and use Pygame to play the background music. You can press SPACE to pause or unpause the music.

Use Pyinstaller to pack Python files in macOS:

Install Pyinstaller:

pip install pyinstaller

Add image repositories in img.qrc:

<RCC>
  <qresource prefix="/" >
    <file>chessboard/image1.png</file>
    <file>chessboard/image2.png</file>
  </qresource>
</RCC>

Encode images in Python file:

pyrcc5 -o img.py img.qrc

For PyQt5 files, import img and add ':' before current_path.

Packing client folder:

pyinstaller --onefile --windowed client/main.py

Add music repositories to main.spec:

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [('music/music1.ogg', r'<current_path>/client/music/music1.ogg', 'music'),('music/music2.ogg', r'<current_path>/client/music/music2.ogg', 'music')],
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=False , icon='gomoku.ico')
app = BUNDLE(exe,
             name='Alpha Gomoku.app',
             icon='gomoku.ico',
             bundle_identifier=None)

Use main.spec to build package:

pyinstaller main.spec

It will generate build/ folder for .pkg files, and dist/ folder for .app files. You can run exec files by double clicks.

Code Test

Pre-commit:

The detail for pre-commit test is inside the file "pre-commit".

Post-commit CI:

The detail for post-commit test is inside the file .travis.yml including language, version, install and requirements.
The post-commit run both python testcase for client and java test cases for server.
client/test.py -- the post-commit file includes multiple boundary conditions and potential faults test.
Travis CI could build our post-commit test and report the job log result.
We use Coveralls as the coverage tool.

Style Checker Tool:

Test Report:

The report for testcase result is inside the folder reports

Authors

  • Chengqi Dai (cd3046), Yiqian Wang (yw3225), Wenbo Song (ws2505), Zhongkai Sun (zs2341)

Acknowledgement

COMSW4156 - ADVANCED SOFTWARE ENGINEERING

  • Prof. Gail Kaiser
  • IA Siddharth P Ramakrishnan