Play | Rules | Spec | Links

About

PRO|STAMINA is a programming game.

A programming game is a computer game where the player has little or no direct influence on the course of the game. Instead, a computer program or script is written in some domain-specific programming language in order to control the actions of the characters or other entities.

In PRO|STAMINA, players have to write javascript Web Workers, that we call “bots”. Bots compete in 1-vs-1 tennis-themed fights.

PRO|STAMINA can be seen as a non-circular variant of Rock Paper Scissors game.

A match

At the beginning of a match, each bot has 600 units of stamina.

A match is a sequence of balls.

For each ball, bots must choose how many units of stamina they will invest. This quantity of stamina is called the “force”. The bot with the higher force wins the ball (the game's scoring system is the same as tennis, without tie-break).
Bots’ stamina is lowered by the force they invested. The ball winner earns 1 stamina unit.
Another ball is played.

Match goes on until both bots have zero stamina.

Bots can’t invest stamina they don’t have.

Bots which have stamina must invest at least 1 unit for each ball.

Example

Here is a simple bot called Smartass.js

    onmessage = function(e) {

        var myComment = "Let's go!";

        var workerResult;

        if (e.data=='play') { workerResult = "1"; } else {

            workerResult = e.data.opponent.force+1;

            if (e.data.me.force > e.data.opponent.force) {
            
                myComment = "Wooo yeah!";
                
            } else {
            
                myComment = "ok...";
                
            }
        }

        postMessage(workerResult+' '+myComment);
    }

How to win

The best way to win is to always invest 1 unit higher than your opponent. If you know your opponent will invest 2 units, then you should invest 3 units of stamina. Obviously, the problem is you don’t know how many units your opponent will invest. So, each bot should study the other bot's gameplay in order to guess its next move, and invest just enough stamina to win.

Another strategy is to let your opponent waste its energy. For instance, if you know your opponent will invest, say, 5 units of stamina, you invest only 1 unit. Your opponent will win the current ball, but at the end of the match, its stamina will fall down to zero before yours, and you'll then win several balls with only 1 stamina unit.

Available data

    e.data.me.force             my force on the previous ball
    e.data.me.stamina           my stamina on the previous ball
    e.data.me.point             my points on the previous ball
    e.data.me.game              my games on the previous ball
    e.data.me.set               my sets on the previous ball
    e.data.me.comment           my comment on the previous ball

    e.data.opponent.force       my opponent's force on the previous ball
    e.data.opponent.stamina     my opponent's stamina on the previous ball
    e.data.opponent.point       my opponent's points on the previous ball
    e.data.opponent.game        my opponent's games on the previous ball
    e.data.opponent.set         my opponent's sets on the previous ball
    e.data.opponent.comment     my opponent's comment on the previous ball

For the first ball of a match, e.data contains only the string 'play'.