Giter Site home page Giter Site logo

Comments (12)

yuarasino avatar yuarasino commented on September 24, 2024 2

Next I will work on this issue.

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

This was what I thought at the begining, and even have implemented it partially. I gave up the idea because a Tenhou log viewer can already be embed, and 場況 can be very complex to be described just by tehai and tsumo/dahai. I will re-consider this.

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

Also, fuuros will need to be recorded and displayed correctly as well.

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

I think I can maintain the hand state in reviewing, including:

  • tehai (sorted)
  • fuuros (also sorted ([0] is naki'd before [1]), and will contain infomation from whose dahai this fuuro was made from)
  • targeted pai from tsumo or dahai (if it is dahai, the player who discarded the tile will also be included, just like what it is right now)

Could you help me in the rendering? I can provide the format of data that will be used in the template.

from mjai-reviewer.

yuarasino avatar yuarasino commented on September 24, 2024 1

Sure! I want to help.

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

The data part is done. You can now pull the latest code, check templates/report.html and look up for those {# TODO: render these #}. You can also render a review to check the data structure, I have put them in a <pre> with json encode.

The template engine is tera.

target_actor

This the actor id we are reviewing. For example if target_actor is 2, then 3 is 下家, 0 is 対面, 1 is 上家, throughout the whole game.

kyokus[*].end_status

It is an array.

Each of its element has a type, which is either "hora" or "ryukyoku".

Each element also has a .deltas, which is an array of score changes. .deltas[0] is the score delta of actor id 0.

For hora, there is an actor and a target. actor is who 和了, target is who 放铳. When target == actor, it means ツモ. If there are multiple ロン, each element represents a single ロン.

Example:

ツモ

[
  {
    "actor": 0,
    "deltas": [
      4300,
      -1100,
      -2100,
      -1100,
    ],
    "target": 0,
    "type": "hora"
  }
]

Double ロン

[
  {
    "actor": 3,
    "deltas": [
      0,
      0,
      -7700,
      7700
    ],
    "target": 2,
    "type": "hora"
  },
  {
    "actor": 0,
    "deltas": [
      3900,
      0,
      -3900,
      0
    ],
    "target": 2,
    "type": "hora"
  }
]

流局

[
  {
    "deltas": [
      -1500,
      -1500,
      1500,
      1500
    ],
    "type": "ryukyoku"
  }
]

kyokus[*].entries[*].state

This is the state of 自家.

If pai is from tsumo (何切る), the tehai will have it as the last element. Except the last pai, all other pais are already sorted.

If pai is from other's dahai (何鳴き), the tehai won't have the extra last element.

In each element of the fuuros field, there is a type field indicating which kind this naki is.

  • For "chi", "pon", "daiminkan", there are target field describing where the pai is from, and pai field describing the naki'd pai.
  • For "kakan", there is no target, only pai.
  • For "ankan", there is no target or pai.

All elements in fuuros have consumed field, which describes the pais taken from tehai to make the naki.

  • For "chi", "pon", it must have and only have 2 elements.
  • For "daiminkan", "kakan", it must have and only have 3 elements.
  • For "ankan", it must have and only have 3 elements.

You can check templates/macros.html for how to render a pai. Note the spaces between pais; in tehai display we don't need them. Also we need to rotate the svg to show fuuros correctly.

Example

{
  "fuuros": [
    {
      "consumed": [
        "9m",
        "9m"
      ],
      "pai": "9m",
      "target": 1,
      "type": "pon"
    }
  ],
  "tehai": [
    "2m",
    "4m",
    "8m",
    "2p",
    "4p",
    "8p",
    "1s",
    "3s",
    "3s",
    "5s",
    "8s",
    "S",
    "P",
    "2p"
  ]
}

Use the following to render 牌背 (used in ankan):

  <svg class="tile">
    <use class="back" xlink:href="#tile"></use>
  </svg>

from mjai-reviewer.

yuarasino avatar yuarasino commented on September 24, 2024 1

Thanks for the quick implementation!
I start working.

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

Some changes are made here:

For "kakan", there is no target, only pai.

Now "kakan" has previous_pon_target, previous_pon_pai, pai and consumed. And the consumed of it has 2 elements, which are the same as previous pon.

Also, you need to pull the latest code as I edited the templates a little.

from mjai-reviewer.

yuarasino avatar yuarasino commented on September 24, 2024 1

Is this OK for drawn tile and discard tile?

when 「自家が を引いた時---」

Display the last tile, "ツモ"
スクリーンショット 2020-03-19 0 58 45

when 「下家が を切った時---」

Display the last tile, "下家"
The same applies to 上家 and 対面

スクリーンショット 2020-03-19 4 49 08

from mjai-reviewer.

Equim-chan avatar Equim-chan commented on September 24, 2024 1

When type is "kakan", the fuuro order was changed.

Thank you for pointing it out, I will fix it.

when 「自家が を引いた時---」

I think if you can render the tehai, the text description can be removed now.

when 「下家が を切った時---」

Maybe it is better to use "下家打" than "下家"?

from mjai-reviewer.

yuarasino avatar yuarasino commented on September 24, 2024

When type is "kakan", the fuuro order was changed.
I cannot fix this in template.

For example, the position of "1s" changes.

スクリーンショット 2020-03-19 16 42 35

from mjai-reviewer.

yuarasino avatar yuarasino commented on September 24, 2024

I think if you can render the tehai, the text description can be removed now.

Maybe it is better to use "下家打" than "下家"?

I fixed.

スクリーンショット 2020-03-19 18 34 45

from mjai-reviewer.

Related Issues (20)

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.