8000 GitHub - radixdlt/foo-hack: In June 2022, three members of the Scrypto community teamed up with redfoo to build a decentralized chess system using Scrypto
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.
/ foo-hack Public archive

In June 2022, three members of the Scrypto community teamed up with redfoo to build a decentralized chess system using Scrypto

License

Notifications You must be signed in to change notification settings

radixdlt/foo-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FooHack

From June 14th to 16th 2022, three members of the Radix community teamed up with redfoo, the legendary musician behind Party Rock Anthem, to build a chess system using Scrypto as a backend. This repository is the result of this three day hackathon.

On the last day of the hackathon, redfoo tested the system by playing a live game against Avaunt, a member of the Radix community. You can see a recap of the match here (we will not spoil the winner).

Scrypto is the asset-oriented smart contract language of the Radix network and allows developers to build smart contract in a more intuitive and secure way. You can find more information about Scrypto here.

The project

The code in this repository is split between the frontend functionality and the Scrypto code. Both were connected together using the Public Testing Environment, that Radix is temporarily providing to be able to connect a frontend to a Scrypto backend before a real test network is out.

Frontend

Using React, @jameswylie built a frontend that you can use to register as a player, list/view/create a chess game and view the leaderboard of players.

Radichess game list Radichess spectate game

Scrypto

You will find two folder within the scrypto directory. One for the main blueprints (radichess) and one for an auction blueprint. The plan was to connect both so that once a chess game ended, an NFT would be minted and put on auction.

It was @RockHoward, @beemdvp and @redfoo22 who worked on that part of the project.

Radichess structure

Inside the radichess source folder, you will find different files. Here is a description of each file:

File Description
radichess.rs This contains the main Scrypto blueprint of the project. It defines the structure for the players and the games, along with defining a blueprint that acts as a game manager. A component instantiated from this blueprint allows people to register as a player, start a new game and manages the list of games.
chess.rs This is a blueprint where each instantiated component represents a single game of chess. Players are able to get the status of the game, join the game, make a move and withdraw a part of the proceeds from the auctioned NFT.
board.rs This file is the heart of the chess engine. It stores the current state of the board, validates the moves and declares the winner once a checkmate is attained.
coordinate.rs This provides a Coordinate structure, used by the chess engine, to represent a coordinate on the chess board. It provides useful methods to do calculations on the coordinates.
piece.rs This provides a Piece structure, again used by the chess engine, to represent a single piece and store some information like how many moves it did and its team.
lib.rs Scrypto packages always need a lib.rs file that describe the modules that it uses. This file simply reference the other files.

How to test

  1. Download the PTE browser wallet here
  2. Go into the frontend directory: cd frontend
  3. Install the dependencies: npm install
  4. Start the local server: npm start
  5. Open the following url in your browser: http://localhost:3000/
  6. If this is the first time opening the app, you should see a button to create a profile. Click on it and type your username. You will then be asked to sign and submit a transaction from the PTE wallet. After running this transaction, you will receive a badge resource in your wallet that represents your identity in the system.
  7. You should now reload the page to see the main dashboard
  8. You can then create/join/spectate games
  9. To view the leaderboard, go to http://localhost:3000/leaderboard

About

In June 2022, three members of the Scrypto community teamed up with redfoo to build a decentralized chess system using Scrypto

Topics

Resources

License

Stars

Watchers

Forks

0