dApp for betting on the outcome of a Tic Tac Toe game.
- 🐣 Project being developed by Newbie's Lounge
- 👷♀️ To view current development tasks, check the Issues on the Github repo.
- 🧰 To chat with other buidlers about this project, join Newbies Lounge Telegram group
- 🛠️ To submit a PR (Pull Request), fork and pull a request to this repo.
- 🐣 Make sure you know the ETH Tech Stack and understand how to make a dApp using Scaffold-ETH 2.
To get started with Tic Tac Toe development, follow the steps below:
- Clone this repo & install dependencies
git clone https://github.com/luloxi/TicTacToe.git
cd TicTacToe
yarn install
- Run a local network in the first terminal:
yarn chain
- On a second terminal, deploy the test contract:
yarn deploy
- On a third terminal, start your NextJS app:
yarn start
Visit your app on: http://localhost:3000
. You can interact with your smart contract using the contract component or the example ui in the frontend. You can tweak the app config in packages/nextjs/scaffold.config.ts
.
Game board consists in 3 rows of 3 element per column. There are 9 possible moves in total.
9 tiles (3 rows x 3 columns)
[0][1][2]
[3][4][5]
[6][7][8]
Win scenarios:
// ROWS
[0, 1, 2]
[3, 4, 5]
[6, 7, 8]
[0, 1, 2], // Row
[3, 4, 5], // Row
[6, 7, 8], // Row
// COLUMNS
[0] | [1] | [2]
[3] | [4] | [5]
[6] | [7] | [8]
[0, 3, 6], // Column
[1, 4, 7], // Column
[2, 5, 8], // Column
// DIAGONALS
[0] | [] | [2]
[] | [4] | []
[6] | [] | [8]
[0, 4, 8], // Diagonal
[2, 4, 6] // Diagonal
Run smart contract test with yarn hardhat:test