Skip to content

Commit

Permalink
fix: configをMatz葉がにロボコンに対応させた (#686)
Browse files Browse the repository at this point in the history
* fix:試合結果のゴールタイムの表示を修正した

* fix:configをMatz葉がにロボコンに対応させた

* fix:configに合わせてテストを修正
  • Loading branch information
kiharu3112 authored Nov 13, 2024
1 parent ab5791f commit b0b13de
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
41 changes: 24 additions & 17 deletions packages/config/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const config = createConfig(
{
type: "elementary",
name: "小学生部門",
robotTypes: ["leg", "wheel"],
},
{
type: "open",
name: "オープン部門",
robotTypes: ["leg"],
},
],
Expand All @@ -27,29 +32,31 @@ export const config = createConfig(
name: "予選",
limitSeconds: 180,
course: {
elementary: 1,
elementary: 2,
open: 1,
},
},
{
type: "main",
name: "本戦",
limitSeconds: 180,
course: {
elementary: 0,
elementary: 2,
open: 1,
},
},
],
rules: [
// {
// name: "multiWalk",
// label: "歩行型",
// type: "single",
// initial: true, // conditionsの"scorable"で制御する
// point: (done: boolean) => (done ? 2 : 0),
// },
{
name: "multiWalk",
label: "歩行型",
type: "single",
initial: true, // conditionsの"scorable"で制御する
point: (done: boolean) => (done ? 2 : 0),
},
{
name: "leaveBase",
label: "水草エリアを出た",
label: "松江エリアを出た",
type: "single",
initial: false,
point: (done: boolean) => (done ? 1 : 0),
Expand All @@ -63,21 +70,21 @@ export const config = createConfig(
},
{
name: "enterDestination",
label: "温暖化エリアに入った",
label: "金星エリアに入った",
type: "single",
initial: false,
point: (done: boolean) => (done ? 1 : 0),
},
{
name: "placeBall",
label: "温暖化エリアに氷を置いた",
label: "金星エリアにプローブを投入した",
type: "single",
initial: false,
point: (done: boolean) => (done ? 1 : 0),
},
{
name: "returnBase",
label: "水草エリアに戻った",
label: "松江エリアに戻った",
type: "single",
initial: false,
point: (done: boolean) => (done ? 2 : 0),
Expand All @@ -91,15 +98,15 @@ export const config = createConfig(
},
{
name: "bringBall",
label: "どじょうの数",
label: "雲粒子の数",
type: "countable",
initial: 0,
point: (count: number) => count,
validate: (value: number) => 0 <= value && value <= 3,
},
{
name: "bringRareBall",
label: "激レアどじょうの数",
label: "激レアメタルの数",
type: "countable",
initial: 0,
point: (count: number) => count,
Expand Down Expand Up @@ -166,11 +173,11 @@ export const config = createConfig(
},
bringRareBall: {
visible: (state) =>
!state.matchInfo || state.matchInfo.matchType === "main", // 本戦以外では激レアどじょうを表示しない
!state.matchInfo || state.matchInfo.matchType === "main", // 本戦以外では激レアメタルを表示しない
changeable: (state) =>
!state.matchState[state.side]?.getPointState().finish,
scorable: (state) =>
!state.matchInfo || state.matchInfo.matchType === "main", // 本戦以外では激レアどじょうに得点を与えない
!state.matchInfo || state.matchInfo.matchType === "main", // 本戦以外では激レアメタルに得点を与えない
},
finish: {
changeable: (state) =>
Expand Down
18 changes: 10 additions & 8 deletions packages/kcms/src/match/service/generatePre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ describe('GeneratePreMatchService', () => {

const expectedTeamPair = [
[
['A1', 'B2'],
['A2', 'B3'],
['A3', 'C1'],
['A4', 'C2'],
['B1', 'N1'],
['B2', 'N2'],
['A1', 'B3'],
['A3', 'C2'],
['B1', 'N2'],
['B3', 'A1'],
['C1', 'A2'],
['C2', 'A3'],
['N1', 'A4'],
['N2', 'B1'],
],
[
['A2', 'B2'],
['A4', 'C1'],
['B2', 'N1'],
['C1', 'A2'],
['N1', 'A4'],
],
];

it('正しく予選対戦表を生成できる', async () => {
Expand Down

0 comments on commit b0b13de

Please sign in to comment.