I've tried a lot of things, tinkering around with how it shifts back, but it always justs gives me the first layer of bricks, which is a flat circle, and then does nothing else. The ghost brick simply flies off into the air and far away.
This is the math I've been doing for this:
function tryGenerateHill(%diameter)
{
if(getSubStr(%diameter, strLen(%diameter), strLen(%diameter)) != 0 || getSubStr(%diameter, strLen(%diameter), strLen(%diameter)) != 2 || getSubStr(%diameter, strLen(%diameter), strLen(%diameter)) != 4 || getSubStr(%diameter, strLen(%diameter), strLen(%diameter)) != 6 || getSubStr(%diameter, strLen(%diameter), strLen(%diameter)) != 8)
mCeil(%diameter+0.1);
%maxSpace = mFloatLength((3.14*%diameter)*0.125, 0);
%curSpace = %maxSpace;
for(%h = 0; %h < %diameter*(mCeil(%diameter*0.33)); %h++)
{
for(%i = 0; %i < %diameter-1; %i++)
{
if(%curSpace > 0 && !%reachedDiameter)
{
for(%skip = 0; %skip < %curSpace; %skip++)
{
superShiftBrickRight(1);
superShiftBrickRight(0);
}
for(%place = 0; %place < %diameter-(%curSpace*2); %place++)
{
plantBrick(1);
plantBrick(0);
superShiftBrickRight(1);
superShiftBrickRight(0);
}
for(%skip = 0; %skip < %curSpace; %skip++)
{
superShiftBrickRight(1);
superShiftBrickRight(0);
}
%curSpace--;
}
else if(%curSpace <= 0 && !%reachedDiameter)
{
for(%place = 0; %place < %diameter; %place++)
{
plantBrick(1);
plantBrick(0);
superShiftBrickRight(1);
superShiftBrickRight(0);
}
%curSpace++;
%reachedDiameter = 1;
}
else if(%curSpace > 0 && %reachedDiameter)
{
for(%skip = 0; %skip < %curSpace; %skip++)
{
superShiftBrickRight(1);
superShiftBrickRight(0);
}
for(%place = 0; %place < %diameter-(%curSpace*2); %place++)
{
plantBrick(1);
plantBrick(0);
superShiftBrickRight(1);
superShiftBrickRight(0);
}
for(%skip = 0; %skip < %curSpace; %skip++)
{
superShiftBrickRight(1);
superShiftBrickRight(0);
}
%curSpace++;
}
for(%realign = 0; %realign < %diameter; %realign++)
{
superShiftBrickLeft(1);
superShiftBrickLeft(0);
}
superShiftBrickAway(1);
superShiftBrickAway(0);
}
%reachedDiameter = 0;
superShiftBrickUp(1);
superShiftBrickUp(0);
//for(%moveBack = 0; %moveBack < %diameter; %moveBack++)
//{
// superShiftBrickLeft(1);
// superShiftBrickLeft(0);
//}
for(%moveBack = 0; %moveBack < %diameter-1; %moveBack++)
{
superShiftBrickTowards(1);
superShiftBrickTowards(0);
}
superShiftBrickAway(1);
superShiftBrickAway(0);
superShiftBrickRight(1);
superShiftBrickRight(0);
%diameter--;
%curSpace = %maxSpace-%h;
}
}
Based on the concept that if the diameter is even, the "height" of the flat circle will always be one brick less than the diameter, and the maximum amount of bricks you can fit in from the "topmost" part of the circle out to as far as the circle extends from there will be around [(pi*diameter)*0.125] bricks.
Edit:
D'oh, wait, I forgot to set %reachedDiameter back after the loop is over, hold on, let me try that.
Edit2:
Those darned coding habits, I put %i instead of %h.
Edit3:
Also forgot to set %curSpace to a correct value.
Edit4:
Got it, sorta. Not really a half-sphere that I was looking for but I can handle that
If anyone can help me with my math I'd be thankful.