mardi 27 décembre 2016

Database - Generate Random "Smart" Data


I'm currently working on developing an RPG-like game with php & pgsql.
I'm having some issue generating random data, it doesn't really have to be random at all because I need to keep a link between records in a separate table.

I have two tables, Room and Has_Passage, the fields in each table are the followings:


Room:

id      starting(boolean)   final(boolean)


Has_Passage:

id      room(FK)            secret(boolean)       towards


The thing is that I have to generate in a random way records in the room table(for example let's set maxNumberOfRooms = 10) but I've also have to keep the rooms linked one another creating some sort of "maze" and I've really no idea how to proceed, any help would really be appreciated!

Thanks.




Aucun commentaire:

Enregistrer un commentaire