Skip to content

Adophilus/tictactoe

 
 

Repository files navigation

TicTacToe

img

Abstract

Tic-tac-toe, noughts and crosses, or Xs and Os is a paper-and-pencil game for two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner. Wikipedia

Motivation

This project was created as my submisssion for the Rust Smart Contract 101 Challenge organized by Dacade x Internet Computer. I decided on this project because I wanted to deploy a canister on the Internet Computer using Rust. Rust seems to be gaining a lot of popularity and so I figured that this would be great time to kill 2 birds with one stone 😁.

Tech Stack

Game Play

  • Create a game by calling the create_game canister function img

  • Play a move by calling the play_move canister function. This canister function takes 2 arguments:

    • The id of the game
    • The coordinates of the move in the format x,y where x is the x coordinate of the move and y is y coordinate of the move

img

  • You can view the game start by calling the get_game canister function and passing in the canister id img

  • Take turns in playing the game until a winner emerges... or the game ends in a draw; either way works 🤷

  • I added in some more functions for convenience. They pretty much do what their names imply. Note that the get_games and the get_player_games function both take in a page number as their sole argument img

Check it out

You can interact with it here: https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=tt2ty-dyaaa-aaaao-a2u2q-cai

Credits

Releases

No releases published

Packages

No packages published

Languages

  • Rust 97.3%
  • Shell 2.7%