# The Sandbox

> Testing leads to failure, and failure leads to understanding.

— Burt Rutan

## The SandBox

The Sandbox is for quick tests and code proving in a 'contained' environment. When developing code, I like to write a snippet and test it as a 'stand-alone'. I also like to have an area where I can isolate a routine and switch it on or off at will, while I develop a larger chunk of code; I use it extensively.

The SandBox is a separate OpenSCAD file, you can find it in The GHOUL’s root directory. It contains as many sandboxes (in the form of modules) as you want, with as many active or inactive as you like. It’s my thing, you can just ignore it, as you please…​

    /*

      <SandBox.scad>

      Hank J. van Leuvensteijn Jr. 2019
      theghoul@hankjr.ca

      This work is licensed under the Unlicense. Do with it as you please, it's not guaranteed to be good for or at anything, actually, it comes with a strict 'Un-Guarantee', declaring it to be fit for nothing at all. Use it at your peril. See License.txt in this directory. Go to <http://unlicense.org/> for more information.

      This is the SandBox.
      This file contains modules that serve no other purpose than to provide a limited scope in which to play with (new) routines etc. Un-comment a call to play within that specific SandBox#() module. To create a new SandBox, add the consecutively numbered call and module ('0' in this example/template) e.g:

    //SandBox0(); // Description -----------------------------------
    module SandBox0()
    {  Echo("SandBox0 is active.");

        // Put your test-code here.

    }

      To activate a particular SandBox, simply un-comment it's call (that's the first comment delimiter in the code block above).

    */

    // Can't do a thing without...
    include<TheGHOUL/Config.scad>

    /*
      Viewpoint declaration, must be in top-namespace.
    */
    //$vpt=[650,650,0];$vpr=[50,0,40];$vpd=4200;

    // Comment the next line to kill all SandBoxes =============== The SandBox Start
    TheSandBox();
    module TheSandBox()
    {
        //SandBox1(); // Description --------------------------------------
        module SandBox1()
        {   Echo("SandBox1 is active.");

            // Put your test-code here.

        }

        // Put as many sandboxes here as you want ----------------------------------

    } // ========================================================== The SandBox End

    // Punisher ====================================================================
    /*
      Timing a routine (under GNU/Linux): Use the following command (in a terminal) to time the runtime execution of any .scad file:

      time openscad -o console.echo ./SandBox.scad

      Use that for example for checking the efficiency of routines, in combination with this 'Punisher()' module:
    */
    //Punisher();
    module Punisher()
    { Echo("The Punisher is active in the SandBox.");

        Foo=[   for(Idex=[0:1000])
                [   for(Jdex=[0:100])
                        // call function to be tested
                    Factorial(100) // This is just a placeholder
                ]
            ];

    }