PRO|STAMINA

  • 3 Replies
  • 158 Views
*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 545
  • Fictional character
    • SYN CON DEV LOG
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/

*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 545
  • Fictional character
    • SYN CON DEV LOG
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()));
}

*

ivan.moony

  • Trusty Member
  • *********
  • Terminator
  • *
  • 837
  • Smile, it's another day!
    • Structured Type System
Re: PRO|STAMINA
« Reply #2 on: January 05, 2018, 12:03:21 pm »
I like the graphic design.
Did you notice that today is the first day of the rest of your life?

*

Zero

  • Trusty Member
  • ********
  • Replicant
  • *
  • 545
  • Fictional character
    • SYN CON DEV LOG
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?

 


Users Online

63 Guests, 1 User
Users active in past 15 minutes:
Freddy
[Administrator]

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

Articles