Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function extend(Child, Parent) {
    var F = function() { };
    F.prototype = Parent.prototype;
    Child.prototype = new F();
    Child.prototype.constructor = Child;
    Child.superclass = Parent.prototype;
}
function rand(min, max) {
    
    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
function PowerGrid() {
    
}
function PowerPlant() {
    this.power = 0;
}
extend(PowerPlant, PowerGrid);
PowerPlant.prototype.setPower = function() {
    this.power = rand(1, 100);
};
function SolarPanel(isDay) {
    this.isDay = isDay;
    this.power = 0;
}
extend(SolarPanel, PowerGrid);
SolarPanel.prototype.setPower = function() {
    if (isDay) {
        this.power = rand(1, 5);
    } else {
        this.power = 0;
    }
};
function House(flats, isDay) {
    this.flats = 0;
    this.isDay = isDay;
    this.power = 0;
}
extend(House, PowerGrid);
House.prototype.setPower = function() {
    if (this.isDay) {
        return 0.004;
    } else {
        return 0.001;
    }
};
House.prototype.setFlats = function() {
    this.flats = rand(1, 400);
};
function ElLines(power, price) {
    this.power = 0;
    this.price = 0;
}
extend(ElLines, PowerGrid);
ElLines.prototype.setPower = function() {
    this.power = rand(10, 80);
    this.price = rand(1, 10);
};
function City() {
    
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
fxslokerpro
0viewers