How to calculate the next available house?

Asked

Viewed 60 times

0

I’m doing a project right now and I’m having a problem with an algorithm. Taking into account the 4 directions ( North,East,South,West), if the user chooses one of the 4, should be allocated the next available house with 1 empty house away.

inserir a descrição da imagem aqui

The house with coordinates ( 0,0 ) cannot be occupied. If no one has yet created account the first person to choose one of the directions gets the first home, for example Selects North gets the N1, Selects South gets the S1. The second person to choose North would be with the square with X to the left of the N1.

How could I return the next available coordinate giving as argument the direction ?

  • No one’s figured it out yet?

  • better you specify with what you want to create it, because it has PHP tag, Javascrip, Mysql, Sql,....

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.