{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 6, "minor" : 0, "revision" : 8 } , "rect" : [ 931.0, 339.0, 838.0, 588.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 0, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 0, "statusbarvisible" : 2, "toolbarvisible" : 1, "boxanimatetime" : 200, "imprint" : 0, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "description" : "", "digest" : "", "tags" : "", "boxes" : [ { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-31", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 510.0, 495.5, 270.0, 47.0 ], "presentation_rect" : [ 507.0, 520.0, 0.0, 0.0 ], "text" : "Try adding different values to the horizontal and vertical coordinates when you build the drawing command" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-30", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 510.0, 450.0, 270.0, 33.0 ], "text" : "What happens if we use a different integer than 2 in the mod statements?" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-28", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 300.0, 297.5, 90.0, 33.0 ], "text" : "Build drawing command" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-12", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 357.0, 390.0, 32.5, 20.0 ], "text" : "+ 1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-23", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 321.75, 390.0, 32.5, 20.0 ], "text" : "+ 1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-9", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 300.0, 474.0, 109.0, 20.0 ], "text" : "prepend framerect" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-24", "maxclass" : "newobj", "numinlets" : 4, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 300.0, 435.0, 76.0, 20.0 ], "text" : "pack 0 0 0 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-26", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 300.0, 345.0, 69.0, 20.0 ], "text" : "unpack 0 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-22", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 540.0, 55.0, 20.0 ], "text" : "send lcd" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-20", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 510.0, 289.0, 18.0 ], "text" : "framerect 78 176 79 177" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-17", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 113.0, 405.0, 97.0, 33.0 ], "presentation_rect" : [ 133.0, 417.0, 0.0, 0.0 ], "text" : "Test each pair of coordinates" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-14", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 474.0, 202.0, 20.0 ], "text" : "if ($i1 == 0) && ($i2 == 1) then bang" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-16", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 80.0, 435.0, 32.5, 20.0 ], "text" : "% 2" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-10", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 30.0, 435.0, 32.5, 20.0 ], "text" : "% 2" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-8", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], "patching_rect" : [ 30.0, 345.0, 32.5, 20.0 ], "text" : "t l l" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-104", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 30.0, 405.0, 69.0, 20.0 ], "text" : "unpack 0 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-21", "linecount" : 2, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 50.0, 165.0, 55.0, 31.0 ], "text" : ";\rlcd clear" } } , { "box" : { "id" : "obj-19", "maxclass" : "button", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], "patching_rect" : [ 30.0, 135.0, 20.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-15", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 30.0, 210.0, 63.0, 20.0 ], "text" : "uzi 20000" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-83", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "bang" ], "patching_rect" : [ 30.0, 242.0, 34.0, 20.0 ], "text" : "t b b" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-82", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 315.0, 56.0, 20.0 ], "text" : "pack 0 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-80", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 108.0, 285.0, 75.0, 20.0 ], "text" : "random 200" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-81", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 30.0, 285.0, 75.0, 20.0 ], "text" : "random 200" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-77", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 108.0, 229.0, 102.0, 33.0 ], "text" : "Create each pair of coordinates" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-13", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 510.0, 405.0, 270.0, 33.0 ], "text" : "What happens if both coordinates are constrained to be even or both to be odd?" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-11", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 510.0, 90.0, 270.0, 47.0 ], "text" : "Much like patch 032, it may not be immediately obvious what consequences a particular set of conditions will have for our final results" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-7", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 150.0, 135.0, 330.0, 60.0 ], "text" : "Here we randomly create thousands of pairs of coordinates. We test each one to see if the horizontal coordinate is even and the vertical coordinate is odd. If so, we plot the point. If not, we discard it." } } , { "box" : { "id" : "obj-5", "maxclass" : "lcd", "numinlets" : 1, "numoutlets" : 4, "outlettype" : [ "list", "list", "int", "" ], "patching_rect" : [ 510.0, 180.0, 200.0, 200.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-1", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 510.0, 150.0, 68.0, 20.0 ], "text" : "receive lcd" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-4", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 90.0, 450.0, 33.0 ], "text" : "A generate-and-test algorithm is one which randomly or exhaustively creates potential solutions and then tests each one to see if it fits some desired condition." } } , { "box" : { "bubble" : 1, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-2", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 15.0, 315.0, 51.0 ], "text" : "Patch 046. Generate and Test\nWilliam J Turkel\nhttp://williamjturkel.net/code/#programming" } } , { "box" : { "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "border" : 1, "id" : "obj-3", "maxclass" : "panel", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 77.5, 810.0, 495.0 ], "rounded" : 20 } } ], "lines" : [ { "patchline" : { "destination" : [ "obj-5", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-1", 0 ] } } , { "patchline" : { "destination" : [ "obj-14", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-10", 0 ] } } , { "patchline" : { "destination" : [ "obj-10", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-104", 0 ] } } , { "patchline" : { "destination" : [ "obj-16", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-104", 1 ] } } , { "patchline" : { "destination" : [ "obj-24", 3 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-12", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-14", 0 ] } } , { "patchline" : { "destination" : [ "obj-83", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-15", 0 ] } } , { "patchline" : { "destination" : [ "obj-14", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-16", 0 ] } } , { "patchline" : { "destination" : [ "obj-15", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-19", 0 ] } } , { "patchline" : { "destination" : [ "obj-21", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-19", 0 ] } } , { "patchline" : { "destination" : [ "obj-22", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-20", 0 ] } } , { "patchline" : { "destination" : [ "obj-24", 2 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-23", 0 ] } } , { "patchline" : { "destination" : [ "obj-9", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-24", 0 ] } } , { "patchline" : { "destination" : [ "obj-12", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-26", 1 ] } } , { "patchline" : { "destination" : [ "obj-23", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-26", 0 ] } } , { "patchline" : { "destination" : [ "obj-24", 1 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 359.5, 375.0, 318.0, 375.0, 318.0, 417.0, 328.5, 417.0 ], "source" : [ "obj-26", 1 ] } } , { "patchline" : { "destination" : [ "obj-24", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-26", 0 ] } } , { "patchline" : { "destination" : [ "obj-104", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-8", 0 ] } } , { "patchline" : { "destination" : [ "obj-26", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 53.0, 375.0, 285.0, 375.0, 285.0, 342.0, 309.5, 342.0 ], "source" : [ "obj-8", 1 ] } } , { "patchline" : { "destination" : [ "obj-82", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-80", 0 ] } } , { "patchline" : { "destination" : [ "obj-82", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-81", 0 ] } } , { "patchline" : { "destination" : [ "obj-8", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-82", 0 ] } } , { "patchline" : { "destination" : [ "obj-80", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-83", 1 ] } } , { "patchline" : { "destination" : [ "obj-81", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-83", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-9", 0 ] } } ], "dependency_cache" : [ ] } }