本文へ移動

Gunjin軍人

階級を隠す5つの対戦ゲームで、配置を非公開に保ち、表示や再生を共有し、1台の端末を交代して遊べます。

「軍人」は、兵士を表す言葉です。 名前について(英語)

目次

やり方

投了と合意の引き分け

終了の操作を、標準の側と手番で行います。

提案し、渡し、確認して受け入れる

import { createHasamiMatch,hasamiRoster,submitHasamiSetup } from "@johnmorrisdotca/gunjin/hasami";
import { acknowledgePass } from "@johnmorrisdotca/gunjin/gunjin-shogi";
const home=(player:0|1)=>hasamiRoster(7).map((kind,x)=>({kind,x,y:player===0?6:0}));
let match=createHasamiMatch({width:7,height:7});
match=submitHasamiSetup(match,0,home(0),match.setupStep);
match=acknowledgePass(match,1,match.turn);
match=submitHasamiSetup(match,1,home(1),match.setupStep);
match=acknowledgePass(match,0,match.turn);
import { offerDraw,acceptDraw,resignMatch } from "@johnmorrisdotca/gunjin/gunjin-shogi";
const offered=offerDraw(match,0,match.turn);
const received=acknowledgePass(offered,1,offered.turn);
console.log(acceptDraw(received,1,received.turn).result);
console.log(resignMatch(match,0,match.turn).result);
{ winner: null, reason: 'agreed-draw' }
{ winner: 1, reason: 'resigned' }

引き分けの提案では端末を渡します。受け取った側が確認し、標準の手番で受け入れるか断ります。合意の引き分けはwinnerがnullです。投了は相手の勝ちです。古い手番や違う側の終了操作は受け付けません。表示の文字や結果の申告だけで終了せず、ホストの標準の流れを使います。

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

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