Kara draws the triangle row by row, walking alternatively from left to right and from right to left:

currentWidth = 1;
left2right = true;

for (y = 0; y < HEIGHT-1; y++) {
  paintRow (currentWidth);
  gotoNextRow (left2right);
  left2right = !left2right;
  currentWidth = currentWidth + 2;
}
paintRow (currentWidth);