Jump to content

Need some help on logic, co-ordinates/map selection


moonman89

Recommended Posts

OK, I'm going to explain this best I can. I know a fair bit of PHP and have been using CodeIgnitor framework for awhile, I'm not after a full program written for me, I'm happy to do it myself, I just can't figure out how to manipulate the data to what I want.

 

I've got a mysql database of planets that is exported from a game, each row contains the latest information on the planet's specifics, including co-ordinates in a galaxy, EG:

 

ID name        gov x y race prod activity tags civ size

2 BaC-loves-u-all 1 0 0 2 2 18477 [] 9 2

 

The fields "X" and "Y", they relate to the co-ordinates on these maps:

http://nova.frozen-dimension.nl/maps/area.php?game=Hyperiums6&x=23&y=-175&xdist=11&ydist=11

 

In the game, we need to build bases of planets, each base's needs to follow the following rules (Roughly, maybe a tolerance?)

1) No more than X planets

2) Each base needs to have 4 of each of the 4 production types, this is the roughly bit.

3) Each base needs one planet with race = 0 and prod 2

4) Each base needs one planet with race = 1 and prod 2

5) Each base needs one planet with race = 3 and prod 2

6) Each base's planets need to be within X distance from each other -- Based of co-ordinates, this can be 0 as there are 3 to 4 planets per coordinate.

 

The distance is based from one square across the map, so either 0 or (+/-1 from x) or (+/-1 from y) or (+/-1 from x and y) would produce a distance of 1

 

The problem I'm having is, I want to be able to say generate a group of bases including as many planets as possible from co-ordinates 23,-175 distance 10

 

Giving me a list of planets that have been excluded, and a list of bases (12 planets ETC) that is best possible with the given planets.

 

I know its a rather hard task, but I'm prepared to nut it out and see what I come up with. I'm starting my best effort now and will post it up when I have something OK...

 

Should this be posted in a MySql forum?

Any help or idea's are more than welcome.

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.