xxxxxxxxxx
69
var Price;
var Bef;
var Aft;
var BgColor;
var count;
var diff;
var rand;
var randP;
var d;
var x;
function setup() {
createCanvas(400, 400);
Price = 0.1;
count = 0;
Bef = 0;
Aft = 0;
BgColor = 0;
diff = 0;
d = 9;
}
function draw() {
background(BgColor);
x = Price - Price/5;
rand = round(random(1,2 + d));
diff = Aft - Bef;
count = count + 1;
randP = random(1 + d/5,2 + d/5);
if(rand > 1 && count % 1 === 0){
Price = Price + randP;
d = d + 1;
}
if(rand == 1 && count % 1 ===0){
Price = Price - randP;
d = d - 1;
}
if(Price<0){
Price = Price + randP;
}
if (count % 600 == 0){
Bef = Price;
}
if (count % 59 == 0){
Aft = Price;
}
if(count % 40 == 0){
d = d-20;
}
console.log(d);
console.log(Price);
}