本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス · ビッグツー

afterTurn関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Whose move it is after from played or passed: the next seat still in that has not passed, or — when nobody is left to answer — the trick cleared and led by whoever played last, or the next seat after them still in.

インポート

import { afterTurn } from "@johnmorrisdotca/toranpu/big-two";

ほかのエクスポート元: @johnmorrisdotca/toranpu/president

定義

function afterTurn<T extends ClimbTrick>(trick: T, from: number): T

引数

名前型説明
trickT

The cards and seats in the current trick.

fromnumber

The source position or source state specified by this API.

戻り値

T

Whose move it is after from played or passed: the next seat still in that has not passed, or — when nobody is left to answer — the trick cleared and led by whoever played last, or the next seat after them still in.

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { afterTurn } from "@johnmorrisdotca/toranpu/big-two";

const names = Array.from({ length: CARD_GAME_TABLES.bigTwo.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("bigTwo", { players: names, seed: 42 })!;
console.log(afterTurn(game, game.toPlay!));
{
  size: 3,
  players: [ 'Seat 1', 'Seat 2', 'Seat 3', 'Seat 4' ],
  computers: [ false, false, false, false ],
  seed: 42,
  moves: [],
  deal: 0,
  phase: 'playing',
  penalties: [ 0, 0, 0, 0 ],
  deals: [],
  hands: [
    [
      '3C', '5H', '7C',
      '8H', 'JS', 'QD',
      'QC', 'QS', 'KC',
      'KH', 'AS', '2C',
      '2S'
    ],
    [
      '3H', '3S', '5S',
      '6C', '6H', '8C',
      '9S', 'TH', 'JC',
      'JH', 'KD', 'AD',
      'AC'
    ],
    [
      '3D', '4D', '4C',
      '4H', '4S', '6D',
      '7D', '7S', '8D',
      'QH', 'KS', '2D',
      '2H'
    ],
    [
      '5D', '5C', '6S',
      '7H', '8S', '9D',
      '9C', '9H', 'TD',
      'TC', 'TS', 'JD',
      'AH'
    ]
  ],
  pile: null,
  passed: [ false, false, false, false ],
  toPlay: 2,
  played: [],
  opening: '3D'
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/toranpu 2.15.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。