06-18-2008, 11:00 PM
|
the fake one
|
|
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
|
|
Quote:
Originally Posted by Stryke
Would this work?
PHP Code:
function onCreated()
{
this.start = timevar2;
this.incompatability = {
{23,46},
{29,44},
{45,96},
{11,77},
{2,32},
{1,12},
{13,69},
};
this.houselist = NULL;
for(temp.i=0; temp.i<100; temp.i++)
{
this.intA = 0;
this.intB = 0;
while(!this.intA && !this.intB)
{
this.intA = int(random(0,400));
this.intB = int(random(0,400));
for(temp.j=0; temp.j<100; temp.j++)
{
if(this.intA == this.houselist[temp.j][0])
this.int = 0;
else if(this.intA == this.houselist[temp.j][1])
this.int = 0;
else if(this.intB == this.houselist[temp.j][0])
this.int = 0;
else if(this.intB == this.houselist[temp.j][1])
this.int = 0;
if(this.intA == this.incompatibility[temp.j])
if(this.intB == this.incompatibility[temp.j])
this.int = 0;
else if(this.intB == this.incompatibility[temp.j])
if(this.intA == this.incompatibility[temp.j])
this.int = 0;
}
if(this.intA == this.intB)
this.int = 0;
}
this.houselist.add({this.intA,this.intB});
}
this.end = timevar2;
}
savelog2("houseList.txt",this.houselist);
echo("Time: " @ this.end - this.start);
Time: 0.026829004
Damn that's slow compared to others lol
|
I didn't try it, but, like said, anything using random will not work well with larger numbers. |
|
|