Giter Site home page Giter Site logo

cgagamj-server's Introduction

cgagamj-server

cgagamj

Flatc

download latest version of flatc from https://github.com/google/flatbuffers/releases, place it into proto folder.

(mqtt) c:\dvlp\cgagamj-server>dir proto
 Volume in drive C is Windows
 Volume Serial Number is F0B9-C1E7

 Directory of c:\dvlp\cgagamj-server\proto

03/03/2024  10:04 AM    <DIR>          .
03/03/2024  10:04 AM    <DIR>          ..
03/03/2024  10:04 AM         3,364,864 flatc.exe
03/03/2024  09:19 AM                 0 mahjong.json
03/02/2024  08:40 PM             1,126 mahjong.proto
               3 File(s)      3,365,990 bytes
               2 Dir(s)  53,127,581,696 bytes free
(mqtt) c:\dvlp\cgagamj-server\>cd python\src\common
(mqtt) c:\dvlp\cgagamj-server\python\src\common>..\..\..\proto\flatc.exe --python mahjong.fbs

Requirements.txt for python

pip install -r src/python/requirements.txt

.env files

the environment variables are handled as secrets and hence not checked into the git repo. Currently the files are stored here and you'd need permission to obtain the env variables

https://drive.google.com/drive/folders/10jrwQPDNv1Gswi_wRddnNs54UpBhIpaC?usp=drive_link

to install package:

C:\dvlp\cgagamj-server\python>pip install -e .

to get vosk models

https://alphacephei.com/vosk/models

how to run unit tests

conda activate mqtt 
(mqtt) c:\dvlp\cgagamj-server\python>pytest -s
=========================================================================================================== test session starts ============================================================================================================
platform win32 -- Python 3.12.2, pytest-8.0.2, pluggy-1.4.0
rootdir: c:\dvlp\cgagamj-server\python
collected 2 items

tests\test_game_utils.py b'\x14\x00\x00\x00\x00\x00\x0e\x00\x0c\x00\x00\x00\x04\x00\x00\x00\x00\x00\n\x00\x0e\x00\x00\x00\x08\x00\x00\x00\x00\x00\x01\x00\x03\x00\x00\x00\x8f\x00z\x00'
Current wind: 0
Current turn: 0
Current round: 1
Discarded tiles: [143   0 122]
.
tests\test_tilemap.py .

============================================================================================================ 2 passed in 0.25s =============================================================================================================

how to run integration test

(mqtt) c:\dvlp\cgagamj-server\python\src>python integration-test.py
Main program continues after starting process running server.py
Main program continues after starting process running client.py
server Connecting to MQTT Broker: ieea4188.ala.us-east-1.emqxsl.com
Port: 8883
Topic: python/mqtt & flatbuffer_topic: python/mqtt-binary
Username: server
client Connecting to MQTT Broker: ieea4188.ala.us-east-1.emqxsl.com
Port: 8883
Topic: python/mqtt & flatbuffer_topic: python/mqtt-binary
Username: client
server Connected to MQTT Broker!
client Connected to MQTT Broker! <paho.mqtt.client.Client object at 0x000001DF2C8E3E90> None ConnectFlags(session_present=False) Success [AssignedClientIdentifier : MzE1MzQ3OTE4NTQ4MjAxMjcwMzc1NTIwMTUyOTgwNjg0ODA, TopicAliasMaximum : 10, RetainAvailable : 1, MaximumPacketSize : 1048576, WildcardSubscriptionAvailable : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 1]
client Send `messages: 0` to topic `python/mqtt`
client Send `(<MQTTErrorCode.MQTT_ERR_SUCCESS: 0>, 2)` to topic `python/mqtt`
server Received `messages: 0` from `python/mqtt` topic
server Received `<common.mahjong.Game.Game object at 0x0000019299F049D0>` from `python/mqtt-binary` topic
Current wind: 0
Current turn: 0
Current round: 1
Discarded tiles: [143   0 122]
client Send `messages: 1` to topic `python/mqtt`
client Send `(<MQTTErrorCode.MQTT_ERR_SUCCESS: 0>, 4)` to topic `python/mqtt`
server Received `messages: 1` from `python/mqtt` topic
server Received `<common.mahjong.Game.Game object at 0x0000019299F04B50>` from `python/mqtt-binary` topic
Current wind: 0
Current turn: 0
Current round: 1
Discarded tiles: [143   0 122]
client Exiting gracefully
Process running client.py received KeyboardInterrupt. Exiting...
server Exiting gracefully
Process running server.py received KeyboardInterrupt. Exiting...
Main program received KeyboardInterrupt. Terminating child processes...
Main program exits gracefully

cgagamj-server's People

Contributors

yksi7417 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.