Thanks to visit codestin.com
Credit goes to github.com

Skip to content

coralsundy/mahjong-player

 
 

Repository files navigation

Mahjong-Player is a fork of the original mahjong suite (@kobalab/Majiang) created by @kobalab.

Several changes are made for my own daily use as well as contributions from others. It includes but not limited to:

app.png

I will take this repository offline if the original author complains. Thanks.


How to Play

Mahjong Player Website:

Desktop App:

Docker Images:


Notable Changes:

  • Add sitemap.xml for docker distribution
  • Add macOS App as well as multi-arch docker images (x64/arm64) to ghcr.io
  • Onboard Tauri to build mahjong-player into an app
  • Make navbar and footer consistent across all the webpages
  • Add docker deployment with dockerfile and updated node scripts, auto deploy package with ghcr.io registry
  • Bundle @kobalab/majiang-server with the game frontend as a whole, update node scripts
  • Switch from @kobalab/tenhou-log server mode to import libs in order to obtain logs from tenhou xml then convert to json

Build from Source

Build Web:

  • npm install - Install all dependencies
  • npm run build:all-dev / npm run build:all-prod - Build static site (./dist), update config/*.json for different base_url
  • npm run build:all-docker - Reserved for docker so that html PUG will apply localhost:8080 and pull og:image from github so not bound to specific domain name
  • npm run build:all-app - Reserved for app, similar to npm run build:all-docker but specifically generated for app
  • npm run server - Start majiang backend express server and host dist after building docs
  • npm run bot - Show commands to start bot and connect to the server

Build App:

  • The app is built with Tauri, please install rustup and ensure rust version up to date
  • npm install - Install all dependencies
  • npx tauri dev - Build static site, start express server, build tauri app and serve the content
  • npx tauri build - Build static site (with docker config), build tauri app with installer based on host arch/plat

Note: A few dependencies may be required for building on linux, see build-dist-apps.yml.

Build Docker:

  • Build docker image manually and deploy:
    • docker build -t mahjong-player:latest -f Dockerfile .
    • docker run -d -p 8080:8080 mahjong-player:latest # Without sitemap
    • docker run -d -p 8080:8080 -e "SITE_URL=https://<my_site_url>" mahjong-player:latest # With sitemap
  • Pull existing image from GitHub Packages, build per commit:
    • docker pull ghcr.io/coralsundy/mahjong-player:latest # Or other tags
    • docker run -d -p 8080:8080 ghcr.io/coralsundy/mahjong-player:latest # Without sitemap
    • docker run -d -p 8080:8080 -e "SITE_URL=https://<my_site_url>" ghcr.io/coralsundy/mahjong-player:latest # With sitemap

Versioning

Mahjong-Player follows a casual development cycle. For releases, we use CalVer to mark overall versions.

Each release includes two main components and often released together:

  • The Web code @kobalab/Majiang stays in sync with the upstream for now, but may branch off later if major features are added.
  • The App code uses SemVer to track major, minor, and patch changes, just like Web.

Original README:

電脳麻将

HTML5 + JavaScript で動作する麻雀アプリ「電脳麻将」

ゲーム画面

デモ

https://kobalab.net/majiang/

ライセンス

MIT

作者

Satoshi Kobayashi

npm-scripts

コマンド 説明
release リリース用にビルドする。
build デバッグ用にビルドする。
build:js JavaScriptのみデバッグ用にビルドする。
build:css CSSのみビルドする。
build:html HTMLのみビルドする。

サブパッケージ

以下のサブパッケージを使って構成しています。

majiang-core

手牌の操作、シャンテン数・和了点計算、局進行・卓情報の管理、思考ルーチンの雛形を含む基本クラス群です。

majiang-ai

麻雀AIとその 開発ツール です。 AIは majiang-core のクラス Majiang.Player の具体的な実装になっています。

majiang-ui

手牌表示、盤面表示、牌譜再生 など画面表示やユーザとのインタラクションを実現するクラス群です。

tenhou-url-log

電脳麻将の牌譜をネット麻雀 天鳳JSON形式の牌譜(各種AI解析の事実上の共通フォーマット)に変換する機能を提供します。

関連パッケージ

そのほかに以下の関連パッケージがあります。

majiang-server

WebSocketによる麻雀サーバーの実装です。 電脳麻将のネット対戦は本サーバに接続して実現しています。

majiang-analog

牌譜解析ツールです。 電脳麻将形式の牌譜を解析する基底クラスを提供します。 本クラスのサブクラスを作成し、解析のためのプログラムを書くことができます。

tenhou-log

ネット麻雀 天鳳 の牌譜を電脳麻将形式に変換します。 本パッケージを利用することで天鳳の牌譜を解析したり、再生したりすることが可能になります。 電脳麻将 牌譜ビューアの天鳳牌譜再生は本サーバに接続して実現しています。

書籍

電脳麻将のプログラムを解説した書籍を出版しました。

書籍ではサブパッケージの majiang-coremajiang-ai を扱っています。

ブログ記事

書籍出版以降(ver.2.0.0以降)の情報です(カッコ内は執筆時のバージョン)。

(旧)ブログ記事

過去のブログ記事。 内容はやや古いです。 ver.2.0.0 のプログラムの情報は 書籍 をご覧ください。 カッコ内は執筆時のバージョンです。

謝辞

ゲームで使用している牌画像は 麻雀の画像・素材、 音声は 天鳳用オリジナルSE: アンコロキングblog のものを使用させていただいてます。

About

修改版電脳麻将(Web+App)-源自@kobalab原始版本

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 37.9%
  • Stylus 36.7%
  • Pug 24.2%
  • Other 1.2%