チンパンジーゲームに挑戦してみた話

1.3K Views

June 24, 23

スライド概要

Japan Power Platform Game Builders JPPGB #6 で登壇させていただきました!(2023/06/24)
https://jppgb.connpass.com/event/284143/

profile-image

Microsoft 365 , Power Platform ( Power Apps | Power Automate )とか

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

チンパンジーゲームに 挑戦してみた話 Chimpanzee Challenge ! @flali_world Japan Power Platform Game Builders JPPGB #6 2023/06/24

2.

PROFILE フロッキー https://www.frog-pod.com/ Twitter @FROKKY_ NAME : ふらり @ ROBO BOY Twitter : @flali_world Blog : https://flali.hatenablog.com/ Docs : https://www.docswell.com/user/fworlddocs @flali_world 2

3.

はじめに 本資料に掲載されている内容は、 いつか人になりたいと思っている 🤖の空想上の出来事です。 内容間違っていたらごめんなさい。 @flali_world 3

4.

JPPGB #4 のあのゲーム、みなさん覚えているだろうか 1 2 9 3 5 4 8 6 7 8×5マスの中に1~9の数字をランダムに配置し、1をタップしたらスタート 1~9まで順番にタップ出来たら成功、間違えたら失敗 @flali_world 4

5.

昔作成したアプリの仕組みがつかえそう 🤖 昔作成した、Aquabeads Designer の仕組みでいけるんじゃない? @flali_world 5

6.

実はコレ… 少ないコントロールで作成できるんです!これぞ、ローコード! @flali_world 6

7.

Gallery in Gallery (通称) Gallery の中に Gallery を組み込み、Sequence関数でカンタンに座標を作成。 Power Apps での Gallery コントロール - Power Apps | Microsoft Learn Power Apps の Sequence 関数 - Power Platform | Microsoft Learn Power Apps の演算子と識別子 - Power Platform | Microsoft Learn Gallery_Parent_Y.Item:Sequence(Y) As ParentItems Point! Gallery_Child_X.Item:Sequence(X) Y座標 X座標 @flali_world 7

8.
[beta]
Gallery in Gallery の座標MAP Collection を作成
ForAll と Sequence関数で座標MAPのCollectionを作成
キャンバス アプリでコレクションを作成、更新する (動画を含む) - Power Apps | Microsoft Learn
Set(Y,5);Set(X,8);
Power Apps での ForAll 関数 - Power Platform | Microsoft Learn
//MAPデータの作成
Clear(colMAP);
ForAll(Sequence(Y) As positionY,
ForAll(Sequence(X) As positionX,
Collect(colMAP,
{
cell: Text(positionY.Value) & "-" & Text(positionX.Value),
number: 0
})))

cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

1-1

0

2-1

0

3-1

0

4-1

0

5-1

0

6-1

0

7-1

0

8-1

0

1-2

0

1-2

0

3-2

0

4-2

0

5-2

0

6-2

0

7-2

0

8-2

0

1-3

0

2-3

0

3-3

0

4-3

0

5-3

0

6-3

0

7-3

0

8-3

0

1-4

0

2-4

0

3-4

0

4-4

0

5-4

0

6-4

0

7-4

0

8-4

0

1-5

0

2-5

0

3-5

0

4-5

0

5-5

0

6-5

0

7-5

0

8-5

0

1つの Collection です。
@flali_world

8

9.

この応用で作成したゲームが Chimpanzee Challenge ! @flali_world 🤖 9

10.
[beta]
判定とゲームデータの作成
座標と座標に対応したテービルの考え方は一緒なので
ゲームで必要なデータを作成します。

//numberCountは-1:数字表示、1-8:次の選択する数字の判定
UpdateContext({numberCount: -1});
//テーブルをシャッフルして、ゲームの初期テーブルcolGameDataを作成
ClearCollect(colGameData,Shuffle(colMAP));
//上から順に1-9の数字のデータをセット
ForAll(
Sequence(9,1,1) As Items,
Patch(colGameData,Index(colGameData,Items.Value),{number: Items.Value})
);
//タイマースタート
UpdateContext({startTimer: true})

Power Apps での Shuffle 関数 - Power Platform | Microsoft Learn
@flali_world

10

11.

座標MAPのテーブルをシャフル、シャッフル ForAll と Sequence関数で座標MAPのテーブルを作成 ClearCollect(colGameData,Shuffle(colMAP)); cell number cell number cell number cell number cell number cell number cell number cell number 1-1 0 2-1 0 3-1 0 4-1 0 5-1 0 6-1 0 7-1 0 8-1 0 1-2 0 1-2 0 3-2 0 4-2 0 5-2 0 6-2 0 7-2 0 8-2 0 1-3 0 2-3 0 3-3 0 4-3 0 5-3 0 6-3 0 7-3 0 8-3 0 1-4 0 2-4 0 3-4 0 4-4 0 5-4 0 6-4 0 7-4 0 8-4 0 1-5 0 2-5 0 3-5 0 4-5 0 5-5 0 6-5 0 7-5 0 8-5 0 colGameData cell number cell number cell number cell number cell number cell number cell number cell number 2-6 0 4-4 0 3-4 0 4-5 0 4-3 0 1-1 0 2-1 0 1-5 0 3-6 0 2-8 0 5-8 0 1-8 0 1-2 0 3-8 0 2-2 0 2-5 0 5-1 0 1-6 0 1-7 0 3-2 0 1-4 0 3-5 0 1-3 0 5-4 0 5-5 0 2-7 0 5-2 0 5-7 0 4-8 0 5-6 0 2-4 0 2-3 0 4-1 0 4-6 0 3-3 0 5-3 0 3-7 0 4-2 0 4-7 0 3-1 0 @flali_world 11

12.
[beta]
1-9の数字をセット
colGameData の Collection に
ForAll と Sequence関数で 1,2,3,4,5,6,7,8,9 の数字を設定します。
//上から順に1-9の数字のデータをセット
ForAll(
Sequence(9,1,1) As Items,
Patch(colGameData,Index(colGameData,Items.Value),{number: Items.Value})
);

colGameData
cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

cell

number

2-6

1

4-4

6

3-4

0

4-5

0

4-3

0

1-1

0

2-1

0

1-5

0

3-6

2

2-8

7

5-8

0

1-8

0

1-2

0

3-8

0

2-2

0

2-5

0

5-1

3

1-6

8

1-7

0

3-2

0

1-4

0

3-5

0

1-3

0

5-4

0

5-5

4

2-7

9

5-2

0

5-7

0

4-8

0

5-6

0

2-4

0

2-3

0

4-1

5

4-6

0

3-3

0

5-3

0

3-7

0

4-2

0

4-7

0

3-1

0

@flali_world

12

13.

Chimpanzee Challenge ! 🤖 @flali_world 13

14.

さいごに まとめ

15.

まとめ 少ないコントロールでもアプリはできる! 昔作成したロジックの転用でもOK! みんなもゲームを作成してみよう! @flali_world 15

16.

Thank you !