PRO|STAMINA

  • 3 Replies
  • 777 Views
*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 732
    • Thinkbots are free
PRO|STAMINA
« on: January 05, 2018, 09:45:09 am »
 
Hi,

I've just realized that I forgot to drop a link to a pet programming game I made several months ago 

It's called PRO|STAMINA. It's a tennis themed betting game where two programs compete in duels.

The program that makes the best predictions of the other program's behavior wins the game. So... who has the deepest learning algorithm?

Tell me what you think. http://pro-stamina.atspace.eu/
Thinkbots are free, as in 'free will'.

*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 732
    • Thinkbots are free
Re: PRO|STAMINA
« Reply #1 on: January 05, 2018, 10:01:26 am »
Here are 3 bots to start with.

Kickass.js
Code: [Select]
var previous = [0,'Love',0,0,'Love',0];

var opGameplay = {};

var myComment = 'Go!';


onmessage = function(e) {

   
    var workerResult;
 
    if (e.data=='play') { workerResult = 2; } else {

        learn(e);
       
        previous = [
            e.data.me.force,
            e.data.me.point,
            e.data.me.game,
            e.data.opponent.force,
            e.data.opponent.point,
            e.data.opponent.game
        ];
       
        myComment = ' ';
       
        var opGuess = guess();
       
        if (opGuess > 5) {
           
            workerResult = 1;
           
        } else {
           
            workerResult = opGuess+1;
           
        }       
    }
   
    postMessage(workerResult+myComment);
}



function learn(e) {
   
    for (var i=0; i<6; i++) {
   
        var situation = e.data.opponent.force+'<='+i+'=='+previous[i];
       
        if (!opGameplay[situation]) {
           
            opGameplay[situation] = 1;
           
        } else {
           
            opGameplay[situation] += 1;
           
        }
    }
}



function guess() {
   
    var best = 0;
    var bestValue = 0;
    var value;

    for (var testForce=1; testForce<10; testForce++) {
       
        value = 0;
   
        for (var i=0; i<6; i++) {
           
            var situation = testForce+'<='+i+'=='+previous[i];
           
            if (opGameplay[situation]) { value += opGameplay[situation]; }
           
        }
       
        myComment += '['+testForce+']='+value+', ';
       
        if (value >= bestValue) {
           
            bestValue = value;
           
            best = testForce;
           
        }
    }   
   
    return best;
}

Smartass.js
Code: [Select]
onmessage = function(e) {

  var myComment = '';

  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);
}

Randy
Code: [Select]
onmessage = function(e) {

  var workerResult = 1+(Math.random()*3);
  postMessage(workerResult+' '+Math.floor(10000000*Math.random()));
}
Thinkbots are free, as in 'free will'.

*

ivan.moony

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1109
    • Some of my projects
Re: PRO|STAMINA
« Reply #2 on: January 05, 2018, 12:03:21 pm »
I like the graphic design.
Dream big. The bigger the dream is, the more beautiful place the world becomes.

*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 732
    • Thinkbots are free
Re: PRO|STAMINA
« Reply #3 on: January 05, 2018, 02:27:27 pm »
Thanks! I tried something futuristic... green from The Matrix, blue from Tron, and red from Roland Garros.  ;)

So... can you beat Kickass.js gentlemen?
Thinkbots are free, as in 'free will'.

 


Users Online

123 Guests, 0 Users

Most Online Today: 140. Most Online Ever: 208 (August 27, 2008, 09:36:30 am)

Articles