Code Monkey home page Code Monkey logo

proton's Introduction

#Proton (1.0.0-rc2 SemVer)

Proton is a protocol for Student Robotics match scoring scripts.

##Execution

  1. A proton compliant program MUST be either a script including a #! line or be a binary.

  2. A proton compliant program MUST be capable of being exec'd on a supported platform. This typically means that it has the executable bit set.

  3. A proton compliant program MUST run on Linux.

  4. A proton compliant program MUST NOT have any side effects beyond printing to STDERR, STDOUT and having a return code. This precludes: modifying its input, writing to a database or any other kind of I/O.

  5. A proton compliant program MUST always give the same output for a given input.

##Inputs

Note: A TLA is defined as a string matching the regex [a-zA-Z]{3}[a-zA-Z0-9]*.

  1. A proton compliant program MUST consume a single argument which is the path to a YAML file containing a computerised interpretation of a Student Robotics scoresheet.

    1.0 A proton compliant program MUST be able to read a file from both absolute and relative paths.

    1.1 A proton compliant program MUST accept YAML files with the proton format, these are of the form:


    match_number: integer
    arena_id: integer or string representing arena identity
    teams: dictionary with 2-4 key value pairs:
        TLA: dictionary with key value pairs:
            zone: an integer between 0 and 3 inclusive
            disqualified: an optional boolean, defaulting to false
            present: an optional boolean, defaulting to true

            any other key value pairs representing data about scoring specific
            to the year and game.

1.2 A proton compliant program MUST exit with 1 if the input is malformed
    YAML or does not comply with rule 1.1
  1. A proton compliant program MUST consume YAML from stdin if it is not given a filename.

  2. A proton compliant program MAY refuse to process an input if it detects nested scoring values it is unable to process. If this occurs it MUST exit with 2.

##Outputs

  1. A proton compliant program MUST print a YAML dictionary to STDOUT if it succeeds.

    1.1 The output must be of the form:

version: string representing version of the proton protocol implemented i.e. (1.0.0)
match_number: an integer representing the match number
arena_id: integer or string representing arena identity
scores: dictionary with exactly as many keys there were teams in the input
    TLA: dictionary with exactly the key value pairs
        score: numeric value, representing team's score (game points).
        present: boolean, value from the input
        disqualified: boolean, value from the input
        zone: integer, the zone the team was in
  1. A proton compliant program MUST exit with 0 if it succeeds.

  2. A proton compliant program's output to STDOUT MUST be considered unusable if it fails.

  3. A proton compliant program MAY print to STDERR under any circumstances.

##Examples

###Valid inputs

match_number: 3
arena_id: A
teams:
    CLF:
     squares : [[1,2,1],[1,0,1],[0,0,0]]
    PSC:
     squares : [[0,0,0],[0,2,0],[0,p,0]]
    BGR:
     squares : [[0,0,0],[3,0,0],[0,0,0]]
    QEH1:
     squares : [[0,0,0],[6,0,0],[0,0,0]]
match_number: 4
arena_id: B
teams:
    CLF:
     present : false
     squares : [[1,2,1],[1,0,1],[0,0,0]]
    PSC:
     squares : [[0,0,0],[0,2,0],[0,p,0]]
    QEH:
     squares : [[0,0,0],[6,0,0],[0,0,0]]

###Invalid inputs

match_number: 3
arena_id: A
teams:
    1:
     present : false
     squares : [[1,2,1],[1,0,1],[0,0,0]]
    PSC:
     squares : [[0,0,0],[0,2,0],[0,p,0]]
    BGR:
     squares : [[0,0,0],[3,0,0],[0,0,0]]
    QEH:
     squares : [[0,0,0],[6,0,0],[0,0,0]]
match_number: 3
arena_id: B
teams:
    CLF:
     present : 1.0
     squares : [[1,2,1],[1,0,1],[0,0,0]]
    PSC:
     squares : [[0,0,0],[0,2,0],[0,p,0]]
    BGR:
     squares : [[0,0,0],[3,0,0],[0,0,0]]
    QEH:
     squares : [[0,0,0],[6,0,0],[0,0,0]]

###Valid responses

version: 1.0.0
match_number: 3
arena_id: A
scores:
    CLF:
        score: 41.0
        present: true
        disqualified: false
        zone: 0
    PSC:
        score: 12.0
        present: true
        disqualified: false
        zone: 1
    BGR:
        score: 7.0
        present: true
        disqualified: false
        zone: 2
    QEH:
        score: 18.0
        present: true
        disqualified: false
        zone: 3

#with exit code 0
#with exit code 1
#with exit code 2

###Invalid responses

No match number

version: 1.0.0
scores:
    CLF:
        score: 41.0
        present: true
        disqualified: false
    PSC:
        score: 12.0
        present: true
        disqualified: false
    QEH:
        score: 18.0
        present: true
        disqualified: false
    BGR:
        score: 7.0
        present: true
        disqualified: false
#with exit code 0

Many missing values

version: 1.0.0
scores:
#with exit code 0

Missing match number and arena ID

version: 1.0.0
scores:
    CLF:
        score: 41.0
        present: true
        disqualified: false
    PSC:
        score: 12.0
        present: true
        disqualified: false
    BGR:
        score: 7.0
        present: true
        disqualified: false
    QEH:
        score: 18.0
        present: true
        disqualified: false
#with exit code 1

proton's People

Contributors

rgilton avatar

Watchers

Fable Tales avatar  avatar

proton's Issues

'Zones' is an overloaded term.

The SR2014 competition features 'corners' (where the robots start) and 'zones' (which are regions in the middle of the arena which any robot can place tokens in).
As a result, the term 'zone' is overloaded in some contexts, which is confusing.

Perhaps Proton should refer to 'starting-zones' or something to be explicit about what it means by them?

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.