Workshop -Tic Tac Toe
Recording on Youtube:
Dial in Information is at: https://casperlabs.atlassian.net/wiki/spaces/REL/pages/136544674/Weekly%2BWorkshops%2BHome
Participants
@Medha Parlikar
@Rita Allen (Unlicensed)
@Tom Vasile (Deactivated)
Ledger Leap - Thomas
@Ashok Ranadive (Unlicensed)
@Maciej Zielinski (Deactivated)
During this workshop, we will play a game of tic-tac-to across multiple players using the CasperLabs DevNet.
Goals
Play a game of tic tac toe between 2 players on the blockchain
Install the client
Build the contracts
Deploy to DevNet
Check the outcome of the transaction by using GraphQL
We will record the session.
Pre-Requisites
Clone the Casperlabs repository
Install Python 3.6+ (If you want to use the Python client)
Install the CasperLabs Client
Step by Step Plan
Clone the repository on your machine
git clone -b dev https://github.com/CasperLabs/CasperLabs.git
git fetch -a
git checkout ECO-285-tic-tac-toe
If you want to run this locally, follow the steps in https://casperlabs.atlassian.net/wiki/spaces/REL/pages/156762625. For this workshop, we will use DevNet
2. Install the client - either with tarballs or debian (or build from source) - These instructions are for the tarball (since this the most generic for platforms)
3. Compile the contracts
cd execution-engine
make setup
make build-contract-rs/tic-tac-toe-smart-contract
cd ..
cd hack/docker/scripts
Now Let’s export some variables that we use in the scripts. Check the path of your casperlabs-client by running the following command to obtain the path.
which casperlabs-client
Export some variables, to make running the scripts easier.
4. Now, let’s Deploy Tic Tac Toe to install it to the blockchain. Deploying a game makes you the host of a game.
Check the status of your deploy in CLarity
5. Start the game with the public keys of 2 players, ‘X' and 'O’
Check the status of the game. At this point you should see an empty board.
Here is an example:
6. Player X sends their play. The grid is represented in this fashion
0 0 | 0 1 | 0 2 |
---|---|---|
1 0 | 1 1 | 1 2 |
2 0 | 2 1 | 2 2 |
This should place an 'X' in the middle of the board.
7. Now we check the status of the game
If you played 1 1 -then you will see an X in the middle of the board- like this:
Now the other player can play:
The 2 players can continue playing until the game is concluded.
Software Version (GitHash)
CasperLabs Client 0.11.0 (5777274434bf8cb676c43b0a0ca28f4e015c683e)
Deployed to DevNet
What you need to know:
Make sure that your client version is the latest released version.
You can re-start the game by doing a fresh deploy of the game with a new account.
You can also re-start the game by re-deploying using the same account, provided that both players are using the same keys.
Make sure your blocks process without errors before proceeding.
Notes:
Title | Description | Notes |
---|---|---|
Verify pre-requisites | Check that everyone has managed to get through the setup. | Does everyone have keys in Clarity? Has everyone cloned the repository and built the contracts? Does everyone have the client installed? What is the version number for the Client? |
|
|
|
Outcome:
If you want to start a new game, have the host run the deploy & start command again using the same keys.
If it looks like your deploy didn’t go through run
and this will give you any error code that you may have hit.
Help!
Go to Discord- we will help you there: https://discord.gg/mpZ9AYD