Giter Site home page Giter Site logo

coding-challenge's Introduction

Coding Challenge

What is it

A framework for presenting coding challenges where participants implement algorithms to solve the same problem. The problem should be one where multiple algorithms compete with each other at the same time.

  1. Gather a bunch of happy coders in a small room
  2. Set up a server connected to a TV-screen to show the battle-grounds
  3. Provide a link and explain the challenge to the participants.

How to set up a challenge

Prerequisites: rust

  1. Clone this repo
  2. cargo run --list-games
  3. cargo run --game spy-master # For example
  4. A UI should pop up, place it on a screen visible to all participants

How to solve a challenge

Start from scratch, or use one of the sample starters in sample-clients/ directory.

For the participants, every challenge has roughly the same structure.

  1. Connect to the server (The host should have provided you with IP:port)
  2. Provide a username (See authentication message below)
  3. The server will send the state of the world your turn
  4. The client will answer with their next move player moves
  5. Repeat from step 3
  6. The server will announce a winner when the game is over game ends
  7. Repeat from step 3

Protocoll

The client should connect through ordinary TCP connection, and exchange message using JSON-format, each one terminated by a newline. The content of the JSON message can not contain a newline.

Auth

First message that is sent upon client connection.

The password below is set the first time you connect, and you should reuse the same username/password connection on every connection after that.

Server -> Client

{"auth":
    {"username": "your_name",
     "password": "your_password"
     }}

Your turn

Game state below will be different for each game. See the details in the README for the specific game you're playing.

Server -> Client

{"your-turn": {game_state}}

Player move

Player move below will be different for each game. See the details in the README for the specific game you're playing.

Client -> Server

{"move": {player_move}}

Game over

After the game over message has been sent, a new round will immediately begin.

Server -> Client

{"game-over":
    {"reason": "winner <username>"|"draw"}}

Errors

In case the server receives input that it can not understand, or is invalid, the client will be sent an error message, and immediately disconnected.

Server -> Client

{"error":
    {"reason": "invalid move"|"invalid message format"|"wrong password"}}

coding-challenge's People

Contributors

souze 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.