Hello. I am attempting to create a plot plugin, whereby all plots in the world can only be built in if the player claims it. I know there are several plugins out there that do just this, but none are quite designed for me because my world is sectioned into two parts - an over-world and a basement. So I started to develop my own to do this - slowly designing the plugin through a means of pseudo code and general text to visualize how it will run. Here's a snippet of code I have so far, and a picture to represent what I'm trying to do and what the code will do. As my plots are divided, a Y variable is to be defined in the layer. The plugin should start from the very center of the map (0, 0) and expands out depending on the amount of plots, the width and the road width, like so (the black square is the plot coverage): With this code, I iterate through a direction (i), and add the plot to the PlotList: Code: public Layer(World world, double y, int plots, int plotWidth, int plotHeight, int roadWidth){ double X = 0; double Y = y; double Z = 0; for (int i = 0; i < 4; i ++){ for (int j = 1; j < plots+1; j ++){ switch (i){ case 0: Z = Z - j*plotWidth - roadWidth; break; case 1: X = X + j*plotWidth + roadWidth; break; case 2: Z = Z + j*plotWidth + roadWidth; break; case 3: X = X - j*plotWidth - roadWidth; break; default: break; } PlotList.add(new Plot(world, X, Y, Z, plotHeight, plotWidth)); } } } 0 = N 1 = E 2 = S 3 = W And here is a picture of what this code will actually do: So can anyone point me in the right direction, as to how to run through each plot so it covers the entire map?
For this problem you need to work with spirals and sequences. ( maths ) I think the easiest way would be to use a line-spiral with the sequence {1,1,2,2,3,3,4,4,5,5...} See also: http://en.wikipedia.org/wiki/Sequence / http://en.wikipedia.org/wiki/Spirals I hope this pushes you into the right direction. Edit: This is a german page but just check the blue line-spiral: http://www.mathematische-basteleien.de/spirale.htm#Spiralen aus Strecken - thats what i meant.