Tournament Sim

This commit is contained in:
Nicky Case 2017-06-21 10:51:55 -04:00
parent 2ddf595e38
commit 27dd21b6a0
8 changed files with 17 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
assets/connection.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
assets/o0006.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -4,11 +4,13 @@ function TournamentSim(config){
self.id = config.id;
// APP
var app = new PIXI.Application(500, 500, {transparent:true});
var app = new PIXI.Application(500, 500, {transparent:true, resolution:2});
self.dom = app.view;
// DOM
self.dom.className = "object";
self.dom.style.width = 500;
self.dom.style.height = 500;
//self.dom.classList.add("fader");
self.dom.style.left = config.x+"px";
self.dom.style.top = config.y+"px";
@ -35,6 +37,11 @@ function TournamentSim(config){
return array;
};
self.networkContainer = new PIXI.Container();
self.agentsContainer = new PIXI.Container();
app.stage.addChild(self.networkContainer);
app.stage.addChild(self.agentsContainer);
self.populateAgents = function(){
// Clear EVERYTHING
@ -119,10 +126,14 @@ function TournamentSim(config){
// HACK: ALL AT ONCE
self.ALL_AT_ONCE = function(){
self.playOneTournament();
self.eliminateBottom(5);
self.reproduceTop(5);
setTimeout(function(){
self.eliminateBottom(5);
},300);
setTimeout(function(){
self.reproduceTop(5);
},600);
};
setInterval(self.ALL_AT_ONCE, 100);
setInterval(self.ALL_AT_ONCE, 1000);
// ANIMATE
/*app.ticker.add(function(delta) {
@ -161,6 +172,8 @@ function TournamentAgent(config){
// Body!
var body = PIXI.Sprite.fromImage("assets/"+self.strategyName+".png");
body.scale.set(0.5);
if(g.x>250) body.scale.x*=-1;
body.anchor.set(0.5);
g.addChild(body);