{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 7, "minor" : 0, "revision" : 1, "architecture" : "x86", "modernui" : 1 } , "rect" : [ 86.0, 78.0, 855.0, 600.0 ], "bgcolor" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "editing_bgcolor" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 1, "objectsnaponopen" : 1, "statusbarvisible" : 2, "toolbarvisible" : 1, "lefttoolbarpinned" : 0, "toptoolbarpinned" : 0, "righttoolbarpinned" : 0, "bottomtoolbarpinned" : 0, "toolbars_unpinned_last_save" : 0, "tallnewobj" : 0, "boxanimatetime" : 200, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "description" : "", "digest" : "", "tags" : "", "style" : "", "subpatcher_template" : "IceCubeTray", "boxes" : [ { "box" : { "id" : "obj-54", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 129.5, 539.0, 34.0, 22.0 ], "style" : "", "text" : "print" } } , { "box" : { "id" : "obj-53", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 185.5, 469.0, 425.0, 74.0 ], "style" : "", "text" : "The code that follows the pair of triggers sets the left, top, right and bottom edge of each little circle that is drawn in the lcd object. The first circle's coordinates are 10 10 20 20 (in the upper left hand corner). The second circle's coordinates are 20 10 30 20. (So it sits just to the right of the previous circle.) Open the console to see the coordinates of each circle drawn." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-51", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 185.5, 388.5, 425.0, 60.0 ], "style" : "", "text" : "One can either process each column in a given row before moving on to the next row (as we are doing here), or each row in a given column. How would you modify the code so that it printed one whole column of circles before moving on to the next one?" } } , { "box" : { "id" : "obj-48", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 185.5, 338.0, 397.0, 33.0 ], "style" : "", "text" : "When the inner uzi is banged, it fires as many times as it is supposed to. (This is set by the num_cols value)." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-82", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 185.5, 254.0, 397.0, 60.0 ], "style" : "", "text" : "One way to process a grid in Max is to use a nested pair of uzi objects. Uzi's rightmost outlet sends an index number for each bang. The first time uzi bangs, it sends a 1 out the rightmost outlet then a bang out the leftmost. The second time it sends a 2, then bangs, and so on." } } , { "box" : { "id" : "obj-45", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 637.0, 381.5, 166.0, 74.0 ], "style" : "", "text" : "In order to draw little circles in the lcd object, we use the paintoval command. Each has the same colour blue (RGB 0 0 255)" } } , { "box" : { "id" : "obj-43", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 595.0, 160.0, 37.0, 22.0 ], "style" : "", "text" : "clear" } } , { "box" : { "id" : "obj-28", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 638.0, 160.0, 94.0, 22.0 ], "style" : "", "text" : "append 0 0 255" } } , { "box" : { "id" : "obj-26", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 638.0, 125.5, 106.0, 22.0 ], "style" : "", "text" : "prepend paintoval" } } , { "box" : { "id" : "obj-20", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 638.0, 93.0, 89.0, 22.0 ], "style" : "", "text" : "receive coords" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-46", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 32.0, 539.0, 76.0, 22.0 ], "style" : "", "text" : "send coords" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-11", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 129.5, 439.0, 32.5, 22.0 ], "style" : "", "text" : "* 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-42", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 97.0, 439.0, 32.5, 22.0 ], "style" : "", "text" : "* 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-13", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 64.5, 439.0, 32.5, 22.0 ], "style" : "", "text" : "* 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-14", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 32.0, 439.0, 32.5, 22.0 ], "style" : "", "text" : "* 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-38", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 129.5, 469.0, 34.0, 22.0 ], "style" : "", "text" : "+ 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-37", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 97.0, 402.0, 57.0, 22.0 ], "style" : "", "text" : "trigger i i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-36", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 32.0, 402.0, 57.0, 22.0 ], "style" : "", "text" : "trigger i i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-15", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 64.5, 469.0, 34.0, 22.0 ], "style" : "", "text" : "+ 10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-23", "maxclass" : "newobj", "numinlets" : 4, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 32.0, 508.0, 76.0, 22.0 ], "style" : "", "text" : "pack 0 0 0 0" } } , { "box" : { "fontface" : 0, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-50", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 59.0, 322.0, 104.0, 22.0 ], "style" : "", "text" : "receive num_cols" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-49", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 32.0, 354.0, 46.0, 22.0 ], "style" : "", "text" : "uzi" } } , { "box" : { "fontface" : 0, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-41", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 59.0, 249.0, 108.0, 22.0 ], "style" : "", "text" : "receive num_rows" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-40", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 32.0, 277.0, 46.0, 22.0 ], "style" : "", "text" : "uzi" } } , { "box" : { "id" : "obj-39", "maxclass" : "button", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], "patching_rect" : [ 32.0, 217.0, 20.0, 20.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-35", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 64.0, 153.0, 29.5, 22.0 ], "style" : "", "text" : "7" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-33", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 302.0, 153.0, 215.0, 33.0 ], "style" : "", "text" : "We start by setting the number of rows and columns that we want to process" } } , { "box" : { "fontface" : 0, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-31", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 152.0, 183.0, 96.0, 22.0 ], "style" : "", "text" : "send num_cols" } } , { "box" : { "fontface" : 0, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-30", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 32.0, 183.0, 95.0, 22.0 ], "style" : "", "text" : "send num_rows" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-29", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 98.5, 153.0, 29.5, 22.0 ], "style" : "", "text" : "11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-27", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 32.0, 153.0, 29.5, 22.0 ], "style" : "", "text" : "5" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-19", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 253.25, 153.0, 29.5, 22.0 ], "style" : "", "text" : "10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-18", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 220.0, 153.0, 29.5, 22.0 ], "style" : "", "text" : "8" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-17", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 185.5, 153.0, 29.5, 22.0 ], "style" : "", "text" : "6" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-16", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 152.0, 153.0, 29.5, 22.0 ], "style" : "", "text" : "4" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-4", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 32.0, 93.0, 465.0, 47.0 ], "style" : "", "text" : "Many things that we might like to represent on a computer are two dimensional (paintings, drawings, photographs, maps, tables of data, etc.) It is thus a common task to have to automatically process each element in a grid of some kind." } } , { "box" : { "id" : "obj-5", "maxclass" : "lcd", "numinlets" : 1, "numoutlets" : 4, "outlettype" : [ "list", "list", "int", "" ], "patching_rect" : [ 637.0, 200.0, 160.0, 160.0 ] } } , { "box" : { "bubble" : 1, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-2", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 15.0, 315.0, 51.0 ], "style" : "", "text" : "Patch 7-034. Processing Grids\nWilliam J Turkel\nhttp://williamjturkel.net/code/#programming" } } , { "box" : { "angle" : 0.0, "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "border" : 1, "id" : "obj-3", "maxclass" : "panel", "mode" : 0, "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 78.0, 810.0, 495.0 ], "proportion" : 0.39, "rounded" : 20, "style" : "" } } ], "lines" : [ { "patchline" : { "destination" : [ "obj-38", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-11", 0 ] } } , { "patchline" : { "destination" : [ "obj-15", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-13", 0 ] } } , { "patchline" : { "destination" : [ "obj-23", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-14", 0 ] } } , { "patchline" : { "destination" : [ "obj-23", 2 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-15", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-16", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-17", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-18", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-19", 0 ] } } , { "patchline" : { "destination" : [ "obj-26", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-20", 0 ] } } , { "patchline" : { "destination" : [ "obj-46", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-23", 0 ] } } , { "patchline" : { "destination" : [ "obj-54", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-23", 0 ] } } , { "patchline" : { "destination" : [ "obj-28", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-26", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-27", 0 ] } } , { "patchline" : { "destination" : [ "obj-5", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-28", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-29", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-35", 0 ] } } , { "patchline" : { "destination" : [ "obj-13", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-36", 1 ] } } , { "patchline" : { "destination" : [ "obj-14", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-36", 0 ] } } , { "patchline" : { "destination" : [ "obj-11", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-37", 1 ] } } , { "patchline" : { "destination" : [ "obj-42", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-37", 0 ] } } , { "patchline" : { "destination" : [ "obj-23", 3 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 139.0, 499.0, 98.5, 499.0 ], "source" : [ "obj-38", 0 ] } } , { "patchline" : { "destination" : [ "obj-40", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-39", 0 ] } } , { "patchline" : { "destination" : [ "obj-43", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 41.5, 243.0, 585.0, 243.0, 585.0, 149.0, 604.5, 149.0 ], "source" : [ "obj-39", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 68.5, 307.0, 174.0, 307.0, 174.0, 369.0, 106.0, 369.0, 106.0, 387.0, 106.5, 387.0 ], "source" : [ "obj-40", 2 ] } } , { "patchline" : { "destination" : [ "obj-49", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-40", 0 ] } } , { "patchline" : { "destination" : [ "obj-40", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-41", 0 ] } } , { "patchline" : { "destination" : [ "obj-23", 1 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 106.5, 469.0, 110.0, 469.0, 110.0, 493.0, 60.5, 493.0 ], "source" : [ "obj-42", 0 ] } } , { "patchline" : { "destination" : [ "obj-5", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-43", 0 ] } } , { "patchline" : { "destination" : [ "obj-36", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 2 ] } } , { "patchline" : { "destination" : [ "obj-49", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-50", 0 ] } } ], "dependency_cache" : [ ], "embedsnapshot" : 0, "default_bgcolor" : [ 0.207843, 0.215686, 0.278431, 1.0 ], "color" : [ 0.901961, 0.901961, 0.901961, 1.0 ], "elementcolor" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "accentcolor" : [ 0.552941, 0.588235, 0.85098, 1.0 ], "selectioncolor" : [ 0.552941, 0.588235, 0.85098, 1.0 ], "textcolor" : [ 0.090196, 0.07451, 0.07451, 1.0 ], "textcolor_inverse" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "patchlinecolor" : [ 0.207843, 0.215686, 0.278431, 0.9 ], "bgfillcolor_type" : "gradient", "bgfillcolor_color1" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "bgfillcolor_color2" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "bgfillcolor_color" : [ 0.290196, 0.309804, 0.301961, 1.0 ], "bgfillcolor_angle" : 270.0, "bgfillcolor_proportion" : 0.39 } }