Jump to content

Help with my logic


SirChick

Recommended Posts

I dont need code help i can probably manage that myself but im having a difficult time figuring out a logical method of how this would work....

 

Basically im making a website sorta creating a simulated airport :/

 

Sounds odd but its just a fun thing to do, trying to make money on a business like game etc... nothing major. But its a good challenge for my coding skills.

 

I'm trying to make a system where by a plane lands on a specific time, then waits at the airport for a specific time before it takes off to another airport. Of which may i add the airports will be controlled by users.

 

And to make things extra complex... the planes are created by users who ever own plane making companies lol!

 

Now i have a few things that logically i cannot work out how to create. I need to create a runway timetable which starts from 00:00 am to 00:00 am of the next day.

 

Then depending on what upgrades the airports have determine how long a plane stays at the airport and how many planes and can land and take off in one day. Thing is i cant think how to create this timetable idea, where by planes won't be landing at same time or taking off at the same time as each other OR will be landing and taking off at same time on the same run ways, basically one slow per plane at any given time. But it is fine for a plane to take off or land whilst other planes are stationary at the airport terminal.

 

Any one got an idea of how to create this logically .. not code wise now... as long as i can think of the logic i can pretty much code it but i been working so much on this I think some other people's input may help me spot something im missing out or find a better approach cos mines failed all the time.

 

 

Just to add, a user requests to the airport for their plane to land at a certain time... and the airport owner agrees/disagrees and picks a free slot for them to land and take off also

Link to comment
Share on other sites

Your logic is fine.  And in my mind, it translates directly into code.  So I am not sure what it is that you need.

 

How about going with a top down approach?  You can start with high level functions like this:

 

landing_request($airport, $plane, $time) {

  Check if $airport is free for landing at $time

  If free, add $plane to timetable and return "granted"

  Otherwise, return "not granted"

}

 

Then you can start thinking about the implementation of the timetable, the airport, the plane.  Knowing how you will use a structure is very helpful when you start designing that structure.  For example, the timetable will probably be searched frequently by time, so it should be a structure that can be efficiently searched by time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.