https://github.com/hadialqattan/online-tictactoe
GUI online TicTacToe using pygame and socket lib.
https://github.com/hadialqattan/online-tictactoe
gui online-tictactoe-game pickle-lib pygame python3 socket-lib
Last synced: about 2 months ago
JSON representation
GUI online TicTacToe using pygame and socket lib.
- Host: GitHub
- URL: https://github.com/hadialqattan/online-tictactoe
- Owner: hadialqattan
- License: mit
- Created: 2020-03-10T09:32:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-26T11:12:12.000Z (over 4 years ago)
- Last Synced: 2023-03-05T05:17:36.769Z (over 2 years ago)
- Topics: gui, online-tictactoe-game, pickle-lib, pygame, python3, socket-lib
- Language: Python
- Homepage:
- Size: 14.5 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Welcome to online TicTacToe game ๐
> online-tictactoe is a GUI online pygame version of tictactoe game with AI, server-side and client network has been created using python socket lib.
# Online-TicTacToe ([Client](https://github.com/hadialqattan/online-tictactoe/blob/master/client))
> Online-tictactoe client is a client-side part of online-tictactoe game using python pygame lib aim to make a wonderful GUI for tictactoe game with simple network using socket and pickle lib.
# Usage ๐
There are two ways to use the client side :
* Using exe version without any requirements :
* Download entire exe dir.
* Configure [server.yaml](https://github.com/hadialqattan/online-tictactoe/blob/master/client/exe/server.yaml) file (set server host & port).
* Run exe/[main.exe](https://github.com/hadialqattan/online-tictactoe/blob/master/client/exe/main.exe).
* Start playing!

* Using [runner.sh](https://github.com/hadialqattan/online-tictactoe/blob/master/client/runner.sh) :
* Install requirements :
```shell
$ sudo pip3 install -r requirements.txt
```
* Run the game :
```shell
$ ./runner.sh g
```
* Start playing!

# Demo ๐งฎ
> You can playing with any connected enemy or playing with AI.
# Play Online (online)
## Start the server to start playing
* configure [server.yaml](https://github.com/hadialqattan/online-tictactoe/blob/master/client/server.yaml) file for client.
* start the server.

## Start playing with stable connection!
* choose empty square using (mouse/keyboard).
* hit enter to set a value.
* wherever you play, your enemy will see the result immediately.

## Winning / Losing cases
* the game will reseted.
* your symbol will changed.

# Play With AI (offline & online)
## Change from online mode to AI mode
* press 'Play With AI' button.
* game will reseted and connection will not recv any data.
* there are four AI engine levels :
* the level will automatically increased when you win.
* maximum level is 4.
* after each game you'll get a new playing symbol.

## Set value and get AI response
* choose empty square using (mouse/keyboard).
* hit enter to set a value.
* you'll get an AI response.

## Winning case
* AI engine level will increased.
* the game will reseted.
* your symbol will changed.

## Losing case
* AI engine level will not increased.
* the game will reseted.
* your symbol will changed.

# Tests ๐งช
Test dir include tests for two classes :
* [network.network.Network](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/network/network.py)
* [tictactoe.tictactoe.TicTacToe](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/tictactoe/tictactoe.py) (only whoWinner function)
* [tictactoe.tictactoe.TicTacToe](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/tictactoe/tictactoe.py) (entire class)
### Run instructions :
* Install requirements:
```shell
$ sudo pip3 install -r requirements.txt
```
* All tests :
* Run all tests using [runner.sh](https://github.com/hadialqattan/online-tictactoe/blob/master/client/runner.sh)
```shell
$ ./runner.sh t
```
* [network.network.Network](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/network/network.py) class :
```shell
$ ./runner.sh tn
```
* [tictactoe.tictactoe.TicTacToe](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/tictactoe/tictactoe.py) (only whoWinner function) :
```shell
$ ./runner.sh tt
```
* [tictactoe.tictactoe.TicTacToe](https://github.com/hadialqattan/online-tictactoe/blob/master/client/src/tictactoe/tictactoe.py) (entire class) :
```shell
$ ./runner.sh ta
```
# Online-TicTacToe ([Server](https://github.com/hadialqattan/online-tictactoe/blob/master/server))
> Online-tictactoe server is a server-side part of online-tictactoe game using python socket lib and pickle lib aim to make a stable connection between two threaded tictactoe players and send/recv data from/to players as objects using pickle lib.
# Usage ๐
There are two ways to use the server :
* Using exe version without any requirements :
* Download entire exe dir
* Configure [server.yaml](https://github.com/hadialqattan/online-tictactoe/blob/master/server/exe/server.yaml) file (set server host & port)
* Run exe/[main.exe](https://github.com/hadialqattan/online-tictactoe/blob/master/server/exe/main.exe)
* Press start button

* Using [runner.sh](https://github.com/hadialqattan/online-tictactoe/blob/master/server/runner.sh) and there are three ways:
* Inside your machine (both CLI & GUI) :
* Install requirements:
```shell
$ sudo pip3 install -r requirements.txt
```
* Configure [server.yaml](https://github.com/hadialqattan/online-tictactoe/blob/master/server/server.yaml) file (set server host & port)
* CLI :
```shell
$ ./runner.sh c
```
* GUI :
```shell
$ ./runner.sh g
```
* Inside docker container (only CLI version) :
* Configure [server.yaml](https://github.com/hadialqattan/online-tictactoe/blob/master/server/server.yaml) file (set server host & port)
* Build and run docker :
```shell
$ ./runner.sh host port
```
```shell
$ ./runner.sh 0.0.0.0 6000
```
# Tests ๐งช
The entire [server.server.Server](https://github.com/hadialqattan/online-tictactoe/blob/master/server/src/server/server.py) unit tests include within tests directory
### Run instructions :
* Install requirements:
```shell
$ sudo pip3 install -r requirements.txt
```
* Run tests using [runner.sh](https://github.com/hadialqattan/online-tictactoe/blob/master/server/runner.sh)
```shell
$ ./runner.sh t
```
# Copyright ยฉ
๐ค **Hadi Alqattan**
* Github: [@hadialqattan](https://github.com/hadialqattan)
* Email: [alqattanhadizaki@gmail.com]()
๐ **License**
Copyright ยฉ 2020 [Hadi Alqattan](https://github.com/hadialqattan).
This project is [MIT](https://github.com/hadialqattan/sudoku/blob/master/LICENSE) licensed.
***
Give a โญ๏ธ if this project helped you!