So I am having a little trouble – I understand the algorithm of the chaos game, got 3 points, set up in a pyramid form. The rest is is easy, just take the current point and a random roll of 1-3 and move halfway from the current point to either a,b or c, depending on the roll. But I am having difficulty with (as you can see in the picture outlined in red) the points plot correctly but just goes straight up. How do I get it to align towards top of the pyramid?
Maybe it is easier to use a GLine that got four parameters for this (x,y,x,y)?


double playGame(double newPointX, double &newPointY, GWindow &display)
{
int roll = randomInteger(DICE_LOW, DICE_HIGH);
// WEST
if (roll == 1) {
}
// EAST
else if (roll == 2) {
}
// NORTH
else if (roll == 3 && newPointY > LIMIT) {
display.drawOval(newPointX,
POINT_NORTH + (newPointY / 2),
1, 1);
newPointY = (newPointY / 2);
cout << newPointY << endl;
return newPointX;
}
return NULL;
}
You aren’t changing your x position. You could do this by calculating the inverse slope of the line between the start point and the end point( top of the pyramid ).
Just use something like:
Then your calculation for the x position would be:
This is without your variables of course but I hope you get the idea.