Skip to content

Commit

Permalink
Fix Tic Tac Toe move argument format (MystenLabs#2499)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Jun 9, 2022
1 parent 1759919 commit da00082
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions doc/src/explore/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Because the admin owns the gameboard, each individual player cannot place a mark
Now let's begin the game!
First of all, let's create a game with the command:
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function create_game --args \"0x$PLAYER_X\" \"0x$PLAYER_O\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function create_game --args $PLAYER_X $PLAYER_O --gas $ADMIN_GAS --gas-budget 1000
```
You will see output like:
Expand Down Expand Up @@ -191,7 +191,7 @@ public(script) fun send_mark_to_game(cap: &mut MarkMintCap, game_address: addres
```
The `cap` argument will be Player X's capability object (XCAP), and `game_address` argument will be the admin's address (ADMIN):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args \"0x$XCAP\" \"0x$ADMIN\" 1 1 --gas $X_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args $XCAP $ADMIN 1 1 --gas $X_GAS --gas-budget 1000
```
And its output:
```shell
Expand Down Expand Up @@ -219,7 +219,7 @@ public(script) fun place_mark(game: &mut TicTacToe, mark: Mark, ctx: &mut TxCont
```
The first argument is the game board, and the second argument is the mark the admin just received from the player. We will call this function (replace the second argument with the Mark object ID above):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args \"0x$GAME\" \"0xAE3CE9176F1A8C1F21D922722486DF667FA00394\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args $GAME 0xAE3CE9176F1A8C1F21D922722486DF667FA00394 --gas $ADMIN_GAS --gas-budget 1000
```
The gameboard now looks like this (this won't be printed out, so keep it in your imagination):
```
Expand All @@ -230,7 +230,7 @@ _|X|_
Player O now tries to put a mark at (0, 0):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args \"0x$OCAP\" \"0x$ADMIN\" 0 0 --gas $O_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args $OCAP $ADMIN 0 0 --gas $O_GAS --gas-budget 1000
```
With output like:
Expand All @@ -246,7 +246,7 @@ Created Objects:
Note, in this second call, the second argument comes from the created objects in the first call.
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args \"0x$GAME\" \"0x7A16D266DAD41145F34649258BC1F744D147BF2F\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args $GAME 0x7A16D266DAD41145F34649258BC1F744D147BF2F --gas $ADMIN_GAS --gas-budget 1000
```
With output like:
Expand All @@ -266,7 +266,7 @@ _|X|_
Player X puts a mark at (0, 2):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args \"0x$XCAP\" \"0x$ADMIN\" 0 2 --gas $X_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args $XCAP $ADMIN 0 2 --gas $X_GAS --gas-budget 1000
```
With output like:
Expand All @@ -282,7 +282,7 @@ Created Objects:
Then run:
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args \"0x$GAME\" \"0x2875D50BD9021ED2009A1278C7CB6D4C876FFF6A\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args $GAME 0x2875D50BD9021ED2009A1278C7CB6D4C876FFF6A --gas $ADMIN_GAS --gas-budget 1000
```
The gameboard now looks like this:
Expand All @@ -294,7 +294,7 @@ _|X|_
Player O places a mark at (1, 0):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args \"0x$OCAP\" \"0x$ADMIN\" 1 0 --gas $O_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args $OCAP $ADMIN 1 0 --gas $O_GAS --gas-budget 1000
```
With output like:
Expand All @@ -310,7 +310,7 @@ Created Objects:
Now run:
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args \"0x$GAME\" \"0x4F7391F172063D87013DD9DC95B8BD45C35FD2D9\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args $GAME 0x4F7391F172063D87013DD9DC95B8BD45C35FD2D9 --gas $ADMIN_GAS --gas-budget 1000
...
```
The gameboard now looks like:
Expand All @@ -321,7 +321,7 @@ O|X|_
```
This is a chance for Player X to win! X now mints the winning mark at (2, 0):
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args \"0x$XCAP\" \"0x$ADMIN\" 2 0 --gas $X_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function send_mark_to_game --args $XCAP $ADMIN 2 0 --gas $X_GAS --gas-budget 1000
```
And its output:
Expand All @@ -337,7 +337,7 @@ AA7A6624E16E5E447801462FF6614013FC4AD156 SequenceNumber(1) o#e5e1b15f03531db118e
And then finally the admin places the winning mark:
```shell
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args \"0x$GAME\" \"0xAA7A6624E16E5E447801462FF6614013FC4AD156\" --gas $ADMIN_GAS --gas-budget 1000
$ wallet call --package $PACKAGE --module TicTacToe --function place_mark --args $GAME 0xAA7A6624E16E5E447801462FF6614013FC4AD156 --gas $ADMIN_GAS --gas-budget 1000
```
With output:
Expand Down

0 comments on commit da00082

Please sign in to comment.