Answer the question
In order to leave comments, you need to log in
Algorithm for generating a map, or how to build a map from "objects"?
Good day!
At first I wanted to paint everything, but then I realized that so most likely I would only get confused myself and confuse you.
That's why I decided to immediately show my "bike" and diagrams, so that I can ask questions based on them.
And so the way is when I build a map with my hands, first I draw it on paper, then I draw it from objects in code.
Location l1 = new Location();
l1.setName("l1");
Location l2 = new Location();
l2.setName("l2");
Location l3 = new Location();
l3.setName("l3");
Location l4 = new Location();
l4.setName("l4");
Location l5 = new Location();
l5.setName("l5");
Location l6 = new Location();
l6.setName("l6");
Location l7 = new Location();
l7.setName("l7");
Location l8 = new Location();
l8.setName("l8");
Location l9 = new Location();
l9.setName("l9");
Location l10 = new Location();
l10.setName("l10");
Location l11 = new Location();
l11.setName("l11");
Location l12 = new Location();
l12.setName("l12");
Location l13 = new Location();
l13.setName("l13");
Location l14 = new Location();
l14.setName("l14");
Location l15 = new Location();
l15.setName("l15");
Location l16 = new Location();
l16.setName("l16");
Location l17 = new Location();
l17.setName("l17");
Location l18 = new Location();
l18.setName("l18");
Location l19 = new Location();
l19.setName("l19");
Location l20 = new Location();
l20.setName("l20");
l1.setDown(l2);
l2.setUp(l1);
l2.setLeft(l6);
l6.setRight(l2);
l6.setDown(l7);
l7.setUp(l6);
l7.setDown(l8);
l8.setUp(l7);
l8.setDown(l9);
l9.setUp(l8);
l9.setDown(l19);
l19.setUp(l9);
l19.setRight(l18);
l18.setLeft(l19);
l18.setRight(l17);
l17.setLeft(l18);
l17.setRight(l16);
l16.setLeft(l17);
l16.setRight(l14);
l14.setLeft(l16);
l14.setDown(l15);
l14.setUp(l13);
l15.setUp(l14);
l13.setDown(l14);
l13.setUp(l12);
l12.setDown(l13);
l12.setLeft(l11);
l11.setRight(l12);
l11.setLeft(l10);
l10.setRight(l11);
l10.setUp(l5);
l5.setDown(l10);
l5.setUp(l3);
l3.setDown(l5);
l3.setRight(l4);
l4.setLeft(l3);
l3.setLeft(l2);
l2.setRight(l3);
l8.setRight(l20);
l10.setLeft(l20);
l20.setRight(l10);
l1.setDown(l2); //Говорим что из локации L1 мы можем пройти в локацию L2
l2.setUp(l1); // Соответственно и из локации L2 мы можем вернуться в локацию L1
...
и так далее.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question