> For the complete documentation index, see [llms.txt](https://resource.optiswap.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://resource.optiswap.pro/internet-computer/dev-guidance/sample-run.md).

# Sample Run

Running the system locally requires deploying a token along with the lobby and game canisters. The game is registered with the lobby as follows:

```
dfx canister call token_lobby_backend registerGame '("Low-Stakes Tic-Tac-Toe", principal"bw4dl-smaaa-aaaaa-qaacq-cai", principal"bd3sg-teaaa-aaaaa-qaaba-cai", "Extreme Tic-Tac Action", 2)'
```

The first step for the user is to do an approval and deposit:

```
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call token icrc2_approve '(record {spender=record{owner= principal"be2us-64aaa-aaaaa-qaabq-cai"; subaccount= null;}; amount=300})'

dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call token_lobby_backend deposit '(principal"bd3sg-teaaa-aaaaa-qaaba-cai", 200)'
```

We join the queue for the Tic-Tac-Toe game twice with the same account to play against ourselves:

```
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call token_lobby_backend joinQueue '("Low-Stakes Tic-Tac-Toe", 100)'
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call token_lobby_backend joinQueue '("Low-Stakes Tic-Tac-Toe", 100)'
```

These both return a gameID of 1, and the 2nd queuing action triggers the start of the game session.

```
dfx canister call ttt gameView '(1)'
```

returns an empty game board `" "`. A series of alternating X and O moves

```
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call ttt input '(1, 0, 0)'
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call ttt input '(1, 1, 0)'
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call ttt input '(1, 0, 1)'
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call ttt input '(1, 2, 0)'
dfx canister --wallet "bnz7o-iuaaa-aaaaa-qaaaa-cai" call ttt input '(1, 0, 2)'
```

gives X the win.

```
dfx canister call ttt gameView '(1)'
dfx canister call ttt gameResult '(1)'
```

Finally the lobby ends the game session, which credits the full 200 tokens back to the winner.

```
dfx canister call token_lobby_backend finalizeGame '("Low-Stakes Tic-Tac-Toe", 1)'
```
