Giter VIP home page Giter VIP logo

reversi's Introduction

Multiplayer Reversi Game on Internet Computer

Read about how the game was made!

This game runs on Internet Computer as a canister. Users can communicate with this canister by sending messages, which are just asynchronous function calls.

Reversi Screenshots

Play it at https://ivg37-qiaaa-aaaab-aaaga-cai.ic0.app

Backend

The game backend is written in Motoko.

register(player_name) - Register the caller using the player name.

start(opponent_name) - Start a game expecting an opponent. If the name is empty string, the game will accept whoever joins next. The first player starting a game will play black, and the second player will play white.

view() - Get the up-to-date game state.

move(row, col) - Place a piece at the given row and column (caller must be a registered player and has started a game).

The game will also keep player scores across all games.

Frontend

The GUI frontend is build with Javascript and Mithril. It is stored as a separate asset canister directly on Internet Computer, and can be loaded at the game URL into a browser.

The terminal-based frontend no longer works with the new multiplayer API. The DFINITY SDK currently lacks a way to switch or use different keypairs, which means the caller identity cannot change, so we don't have a way to run the game using the dfx command.

Installation

To run the game locally, you need to install DFINITY SDK first, which also requires Node.js and npm.

After starting dfx (dfx start --background), run the following to build and install the canister:

dfx deploy
echo "http://localhost:8000/?canisterId=$(dfx canister id reversi_assets)"

The last command prints a URL, load it in a browser, and enjoy!

License

All original code is released under MIT license. The game UI also uses a free font Akbar-Plain made by Jon Bernhardt.

reversi's People

Contributors

ninegua avatar nquinlan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.