% example.tex -- Demonstration document for mahjonggame
% Copyright 2026 Clignniis
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
%
% This work has the LPPL maintenance status `maintained'.
% The Current Maintainer of this work is Clignniis.

\documentclass[a4paper,11pt]{article}
\usepackage{mahjonggame}
\usepackage[a4paper,margin=20mm]{geometry}
\usepackage{hyperref}
\usepackage{listings}

\title{\textsf{mahjonggame} -- Examples}
\author{Clignniis}
\date{Version 0.7.0}

\lstset{
  basicstyle=\ttfamily\small,
  frame=single,
  columns=fullflexible,
  breaklines=true,
  showstringspaces=false
}

\begin{document}
\maketitle

\section{Tile drawing}

\subsection{Basic sequences}

\lstinline|\tile{123456m}|:
\[
  \tile{123456m}
\]

\lstinline|\tail{123m;456s;789p}|:
\[
  \tail{123m;456s;789p}
\]

\subsection{Directions}

\[
  \tile{1m;2m[direction=left];3m;4m[direction=right];5m;6m[direction=reach]}
\]

\subsection{Compact directional notation}

\[
  \tail{123`45m}
  \qquad
  \tail{123''45m}
  \qquad
  \tail{1*2345m}
\]

\subsection{Colours, functions, and spacing}

\[
  \tile{5m[color=yellow];5s[color=blue];5p[color=green!35]}
\]

\[
  \tile{1s[function={emph,flash,take}]}
  \qquad
  \tile{2s[function={flash}]}
  \qquad
  \tile{3s[function={take}]}
\]

\[
  \tile{123m;-;456m}
  \qquad
  \tile{123m;gap=0.75;456m}
\]

\section{Complete game}

\begin{figure}[p]
  \centering
  \begin{game}[0.58]
    \aWind{東}
    \bWind{南}
    \cWind{西}
    \dWind{北}

    \aScore{25000}
    \bScore{24000}
    \cScore{26000}
    \dScore{26000}

    \round{東一局}

    \aDiscard{123456m;789s;123p}
    \bDiscard{456m;789p;123s}
    \cDiscard{123m;456s;789p}
    \dDiscard{111m;222s;333p}

    \aHand{123m;456s;789p;11z}
    \bHand{234m;567s;789p;22z}
    \cHand{345m;678s;123p;33z}
    \dHand{456m;789s;234p;44z}

    \aClaim{111z}
    \cClaim{555m;666p}

    \aFlower{1f;2f}
    \dFlower{3f}

    \dora{123m}
    \info
  \end{game}
  \caption{Four-player example.}
\end{figure}

\section{Three-player game}

\begin{figure}[p]
  \centering
  \begin{game}[0.54]
    \aWind{東}
    \bWind{南}
    \cWind{西}
    \round{東二局}

    \aDiscard{123456m;789s}
    \bDiscard{456p;123s;789m}
    \cDiscard{234m;567s;111p}

    \aHand{123m;456s;789p;11z}
    \bHand{234m;567s;789p;22z}
    \cHand{345m;678s;123p;33z}

    \totaltiles{94}
  \end{game}
  \caption{Three-player example.}
\end{figure}

\section{Dora}

Dora accepts ordinary compact notation and is padded with the \texttt{0z} tile back when fewer than five tiles are supplied.

\begin{figure}[ht]
  \centering
  \begin{game}[0.42]
    \dora{123m}
  \end{game}
  \caption{Dora indicator.}
\end{figure}

\end{document}
