Samples / Chess for Power Apps
Power Apps canvas app
Chess for Power Apps
Microsoft's chess game for Power Apps, a real canvas app published under the MIT licence: eleven screens, a board held in collections, moves validated in Power Fx, games saved and replayed from PGN notation. Converted by the command-line tool and reconciled against Microsoft's Power Fx interpreter.
Source: Chess_for_Power_Apps_v1.03.msapp from microsoft/PowerApps-Language-Tooling at commit 82d30e9, MIT licence, msapp-json layout. Converted as published, with no edits.
- Screens
- 11
- Controls
- 159
- Formulas
- 4,586
- Behaviour events
- 73
- Data sources
- 26
What the app contains
- A real app, not a synthetic one: Microsoft's chess game for Power Apps, eleven screens, 159 controls and 4,586 formulas, published under the MIT licence in the PowerApps-Language-Tooling repository and converted here unchanged.
- Board state as collections: colBoard, colPieces, colCastling and nineteen others, filled by App.OnStart and rewritten by 73 behaviour formulas through Set, ClearCollect, Patch, UpdateIf and Remove. Every one of those events becomes a handler in the behaviour specification; none of their 478 steps was beyond the translator.
- Chess notation as text processing: FEN and PGN strings taken apart with MatchAll, Split, Concat, Trim and With (102 With blocks). This app is where the interpreter settled that Trim keeps line breaks, that Sort orders equal keys the way .NET does, and that Len counts UTF-16 units.
- Twelve galleries whose Items formulas (Filter, AddColumns, RenameColumns, Sort, FirstN) are reconciled row by row. The 34 unchecked properties are named one by one with the reason rather than claimed: Ungroup and GroupBy, which the interpreter recognises but does not support; Office365Users connector calls and a URL parameter, which mean nothing outside the player; regular expressions and canvas spellings the interpreter rejects; and two GUID() calls whose value is new on every evaluation.
- Undeclared data: twelve names the package never declares (GameServer, GamePlayerData and GameList among them) are reported as unresolved; those used as tables become input tables with a translation note, and the 74 input-type assumptions the schema inference had to make are listed in the report so a reader can supply real values instead.
2,952 computed formulas and 1,634 constants over 4,004 function calls to 94 distinct functions; 58 variables and 22 collections. Controls: Label (34), Toggle (16), Button (15), Image (12), Icon (12), Gallery (12), GalleryTemplate (12), Checkbox (10), DataCard (9), TextInput (6). Functions used most: RGBA (1174), If (306), LookUp (140), And (133), ColorFade (123), Text (114), Filter (111), Switch (110), Concat (102), With (102), Last (80), Min (77). Behaviour functions: Set (200), ClearCollect (32), Navigate (27), Notify (24), Select (19), Patch (16), Clear (14), Collect (8).
Reconciliation against the Power Fx interpreter
An app has no stored values to compare with, so the tool infers the shape of its inputs, generates 20 seeded input sets (5 rows per table at most, seed 20261014), and evaluates every translated formula in Microsoft's open-source Power Fx interpreter 1.99.0.0 on the same inputs, gallery row by gallery row. 90,330 comparisons in 18.27 s. Reconciled means tested equivalence on those inputs, not a guarantee for inputs nobody tried.
| Properties | Reconciled | Differing | Unchecked | Not translated | Evidence |
|---|---|---|---|---|---|
| 4,844 | 4,719 (97.4%) | 0 | 34 | 91 | Reconciliation App map Behaviour Code (zip) |
Unchecked means the interpreter could not evaluate the formula (a canvas-only function or enumeration), so nothing is claimed for it; the report names each one with the reason. Not translated covers behaviour formulas, which are read into the behaviour specification instead, and anything the translator refused rather than guessed. 74 input types were assumed from how the formulas use them; the report lists every assumption so real values can replace them. Names the package never declares, reported as unresolved (those used as tables become input tables): GameServer, Piece_FEN, stringByRow, Y, X, GamePlayerData, Player_FEN, X_FEN, GameList, File, Rank, Move.
The behaviour specification
73 behaviour formulas (OnSelect, OnVisible, OnStart and the like) were read into 478 steps: 200 write, 95 branch, 58 effect, 54 collection, 27 navigate, 15 scope, 15 data, 7 value, 4 context, 3 loop. Each becomes a Python handler that applies the same steps to a context: state is written, navigation is recorded, and actions that leave the app are logged rather than performed (Notify 24, Select 19, Refresh 7, Reset 6, Trace 1, PowerAppsNotification.SendPushNotification 1). 2 steps were not fully translated and are marked as such, each with its reason. The 258 value expressions inside those steps were translated and reconciled like properties. This is a specification for whatever replaces the app, not a claim that the actions were tested end to end.
The generated code
How to reproduce
The command-line tool runs this conversion from the published file:
power-migrate convert-app Chess_for_Power_Apps_v1.03.msapp --variations 20 --seed 20261014
The interpreter check needs the .NET SDK; without it the translation still runs and the report says nothing was checked. The same inputs give the same report.