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 589983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:28:51+00:00 2026-05-13T15:28:51+00:00

I’m currently working on drawing a tournament bracket for one of my projects. It

  • 0

I’m currently working on drawing a tournament bracket for one of my projects. It seems to be working drawing smaller brackets but once I get to 16 it starts acting up.

Follow through the links, and see how it falls out of place after 8.

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/2

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/4

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/8

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/16

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/32

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/64

http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/128

After that I get out of ram errors, which isn’t really an issue since its legitimate use of ram, and I can justify raising the maximums for this script (of course, it won’t run every page load in the final script,the image will be cached).

Anyways, As you can see if you progress through the images, they seem to get more and more off track.

The code is here:
http://pastebin.com/f5485b027
(should I be posting code like this, or inline? I wasn’t sure)

I am completely lost as to how to fix this, so please input ideas/suggestions. I don’t need a code solution, I just need guidance on the math/positioning.

Thanks,
Matt

  • 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-05-13T15:28:51+00:00Added an answer on May 13, 2026 at 3:28 pm

    The brackets are “correctly” drawn based on the algorithm.

    Did you step through the code for the problem cases especially for $y?

    i’m not sure how the algo works (don’t really understand the use of the $takeAway).

    But this is what i would come up with:

    for ($k = 1; $k < ($rounds + 1); $k++)
    {
        // Calculate currLeftDraw and currRightDraw Here...
    
        $spacing = 60 * pow(2, ($k - 1));
        $firstY = ($spacing / 2) - 30;
    
        for ($i = 0; $i < ($sizePlayers / (pow(2, $k))); $i++)
        {
            $yPos = $firstY + ($i * $spacing);
    
            // Rest of code here...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into

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.