Kara draws the triangle row by row, walking alternatively from left to right and from right to left:
int currentWidth = 1; boolean left2right = true; for (int y = 0; y < HEIGHT-1; y++) { paintRow (currentWidth); gotoNextRow (left2right); left2right = !left2right; currentWidth = currentWidth + 2; } paintRow (currentWidth);