Skip to content

Commit

Permalink
Fixed potential payoff line.
Browse files Browse the repository at this point in the history
git-svn-id: file:///svn/CONGv2.0/trunk@2398 637b740e-b1db-41bf-a134-2c17f54ac410
  • Loading branch information
LeepsLab committed Oct 30, 2012
1 parent 9c77040 commit cb43292
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
11 changes: 4 additions & 7 deletions configs/WeakestLink.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
period,paid,length,subperiods,percentChangePerSecond,groupSize,payoffFunction,source,min,max,strategies,params,mixed,selector,potential,grid
1,TRUE,60,0,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
2,TRUE,60,0,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
3,TRUE,60,0,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
4,TRUE,60,10,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
5,TRUE,60,10,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
6,TRUE,60,10,NaN,4,script,WeakestLink.java,0,10,1,Alpha=1.0,TRUE,bubbles,TRUE,0.1111111111
"period","paid","length","subperiods","percentChangePerSecond","groupSize","payoffFunction","source","min","max","strategies","params","mixed","selector","potential","grid"
1,"TRUE",300,0,"NaN",4,"script","WeakestLink.java",1,10,1,"Alpha=1.0","TRUE","bubbles","TRUE",0.1111111111
2,"TRUE",300,0,"NaN",4,"script","WeakestLink.java",1,10,1,"Alpha=1.0","TRUE","bubbles","TRUE",0.1111111111
3,"TRUE",300,0,"NaN",4,"script","WeakestLink.java",1,10,1,"Alpha=1.0","TRUE","bubbles","TRUE",0.1111111111
23 changes: 14 additions & 9 deletions configs/WeakestLink.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

/**
* Copyright (c) 2012, University of California
* All rights reserved.
*
* Copyright (c) 2012, University of California All rights reserved.
*
* Redistribution and use is governed by the LICENSE.txt file included with this
* source code and available at http://leeps.ucsc.edu/cong/wiki/license
**/


*
*/
import edu.ucsc.leeps.fire.cong.FIRE;
import edu.ucsc.leeps.fire.cong.client.Client;
import edu.ucsc.leeps.fire.cong.client.gui.PeriodInfo;
Expand Down Expand Up @@ -240,13 +239,19 @@ public float getMin() {

private void drawPotentialPayoffs(Client a) {
float[] s = {0};
float min = config.payoffFunction.getMin();
float max = config.payoffFunction.getMax();
a.stroke(50);
for (float x = 0; x < a.width * scale; x++) {
s[0] = x / (a.width * scale);
float u = PayoffUtils.getPayoff(s);
float y = u / max;
a.point(x, a.height * scale * (1 - y));
float payoff = PayoffUtils.getPayoff(s);
float y = a.height * scale * (1 - (payoff - min) / (max - min));
if (y > a.height * scale) {
y = a.height * scale;
} else if (y < 0) {
y = 0;
}
a.point(x, y);
}
}

Expand Down

0 comments on commit cb43292

Please sign in to comment.