Skip to content

hongyu-yan1998/touche-coule

Repository files navigation

Touché Coulé

authors : Hongyu YAN & Liuyi CHEN

Welcome to the DAAR project. The idea will is to implement a "Touché Coulé" (Battleship) game in a decentralized way, on Ethereum. This will have cool side effects, like not be forced to pay for servers. The project can't be run on Windows. If you are in Windows, you have to use WSL.

Installation

Run the complete project.

# Yarn users
yarn dev

Subject

Implement a Touché Coulé from scratch in Solidity. The game is running into a contract by its own. We have created 4 agents (i.e. a smart contract) to play the game.

What we have implemented

  • We created 4 contracts to get 2 ships for each account. Then these 4 ships are deployed in the same way in the file 000001-deploy-game.ts.
  • When clicking on the Register button, two different ships are created for each of the two accounts in turn according to the order. In App.tsx, we register the address of the ship that to be created into Main.sol.
  • Each player can only have 2 ships.
  • Switch the account to play as a new player.
  • In each turn, we fire at a random address.

Smart contract

One player can only have one destroyer and one battle ship. Each ship has similar variables: a data structure with horizontal and vertical coordinates, widthGame width and heightGame height of the canvas.

The picture below shows the interface of two players after they have registered 2 ships each. image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •