Giter Club home page Giter Club logo

boxing's People

Contributors

yetzt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

boxing's Issues

No license....

Good day to you.
I would like to use this code in my project.
Sorry for making it an issue - I failed to find a private message or email of yours.
Please tell if I can use it or what is needed to acquire a license from you to use this code.
Thank you very much.
Ilia Lev

Notice: Undefined index: longest_side

I tried playing around with the class and noticed an error when the boxes should fit:

Notice: Undefined index: longest_side

private function _sksort($array, $subkey, $sort_descending=false, $keep_keys_in_sub=false) {
    foreach ($array as $key => &$value) {
        $sort = array();
        foreach ($value as $index => $val) {
            $sort[$index] = $val[$subkey]; // << This is the line producing the error
        }

If the inner boxes do not fit everything works fine, however (function "fits()" returns "false")

Understanding the logic

Hey im trying to understand the logic and how to use this properly.

Here is the code i used for testing:

$boxing = new Boxing();
        $boxing->add_outer_box(100, 100, 100);

        $boxing->add_inner_box(50, 50, 50); //1/4
        $boxing->add_inner_box(50, 50, 50); //1/4

        if ($boxing->fits())
        {
            var_dump($boxing);
        }

It returns a array of outer_boxes of length 6, which confuses me.
The first 2 item in the outer_boxes array are set has "Packed" true.

Can I get a return that say of item 1,2,3 goes in box 1 and item 4,5,6 goes in box 2 for example.

incorrect logic

// fits exactly example
$b = new Boxing();
$b->add_outer_box(100,100,100);
$b->add_inner_box(50,50,50);
$b->add_inner_box(50,50,50);
$b->fits(); //it returns true...OK, fine..packed with 2 boxes!

// NOT fits example
$b = new Boxing();
$b->add_outer_box(100,100,100);

$b->add_inner_box(50,50,50);
$b->add_inner_box(50,50,50);
$b->add_inner_box(50,50,50);
$b->fits(); // it returns true. this should return to false.

Why return true?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.