Skip to content

MongMikng/AlphaJong

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About The Project

This project is a Mahjong AI for Mahjong Soul that runs directly in any browser. Everything was written from scratch in native JavaScript without any libraries.
The AI does not use machine learning, but conventional algorithms. Simply said it's simulating some turns and looking for the best move.
Compatible with both 3 and 4 player mode.
日本語版readmeはこちら.
不幸的是,没有中文的readme.

Getting Started

  • Install a browser extension that lets you run userscripts, like Tampermonkey.
  • Grab the latest release of this project and install it in your browser extension. (For Tampermonkey you can enter the download url at utilities -> Install from URL).
  • Open Mahjong Soul (make sure you are logged in already).
  • Go into a game and click "Start Bot" in the GUI at the top.
  • You can check "Autostart" to let the bot automatically start new games.
  • Logging is output to the browser console (Ctrl + Shift + J [Chrome] or Ctrl + Shift + K [Firefox])

GUI

GUI There is a very simple GUI to control the Bot.

  • Left Button: Start or Stop the Bot.
  • Checkbox: Enable Autorun mode. The bot will automatically reload the site and search for a new game after the previous one is finished. The Room can be chosen in the ComboBox next to it.
  • Output Field: Simple Logging what the bot is currently doing or waiting for.
  • Right Button: Hide the GUI. You can re-show it by pressing + on the Numpad.

Parameters

The default parameters are usually fine. If you want to modify the behaviour of the bot (e.g. more aggressive playstyle) you can change some constants at the top of the script:

  • Defense Constants: Constants that modify the defensive playstyle.
  • Calls: Constants that modify how often the bot calls for tiles.
  • Hand Evaluation Constants: Constants that modify how the value of hands is calculated. Influences if the bot goes for fast or expensive hands.
  • Strategy Constants: See Comments

Statistics

Stats

The bot is able to reach Master rank.

Yakuman

Tests

The project contains a testclass with simple "Nani Kiru?" testcases.

Known Problems

-Sometimes the game disconnects you for AFK. This usually happens if the window is minimized or you switch to another tab for a while (not having focus is fine, as long as the window is open). If that happens the bot will try to reconnect by reloading the page.

Disclaimer

Bots are a violation of Mahjong Soul's Terms of Service. This means you can theoretically get banned for using this script. There have been no reports of any bans yet, but you need to be aware that this is on your own risk and the creator of the bot is not responsible for your actions.

About

A Mahjong AI for Mahjong Soul

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.5%
  • HTML 0.5%