Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:47:26+00:00 2026-06-14T11:47:26+00:00

So I am having a little trouble – I understand the algorithm of the

  • 0

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)?

enter image description here

enter image description here

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;

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:47:27+00:00Added an answer on June 14, 2026 at 11:47 am

    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:

    float inverseSlope = (xTop - xLeft) / (yTop - yLeft);
    

    Then your calculation for the x position would be:

    xPosition = (yPosition * inverseSlope) + xLeft; //xLeft being your start position
    

    This is without your variables of course but I hope you get the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having a little trouble setting up routes. I have a 'users' controller/model/views set
I'm having a little trouble setting a form using inner HTML: document.getElementById(Button).innerHTML='<form action=add.php method=post
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to
I m having little trouble finding a relation between the movement at centre and
Im having a little trouble with a php script ive made. you can see
I'm having a little trouble getting Jquery to play nice with cakephp and I'm
I'm having a little trouble using AmazonCloudWatch to fetch CPU Utilization. When I try
I am having a little trouble trying to accomplish this. Here is the gist
I am having a little trouble with jScrollPane . I created a list of
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.