{"id":307,"date":"2021-09-04T17:46:31","date_gmt":"2021-09-04T21:46:31","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/?p=307"},"modified":"2021-09-05T17:40:24","modified_gmt":"2021-09-05T21:40:24","slug":"marimonda-molnar-recode","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/marimonda\/09\/04\/marimonda-molnar-recode\/","title":{"rendered":"marimonda &#8211; Molnar Recode"},"content":{"rendered":"<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/molnar-1.svg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-320\" src=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/molnar-1.svg\" alt=\"\" width=\"640\" height=\"480\" \/><\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/molnar.svg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-310\" src=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/molnar.svg\" alt=\"\" width=\"640\" height=\"480\" \/><\/a><!--more--><\/p>\n<p><strong>Assertions:<\/strong><\/p>\n<ul>\n<li>Patterns are applied through two cells, horizontally and diagonally.<\/li>\n<li>Most patterns are parallel, but not all of them. Non-parallel patterns are followed by two blocks of curve stitches. This is the only &#8220;three-block&#8221; pattern.<\/li>\n<li>Rows and columns have similar patterns.<\/li>\n<li>Approximately 60 x 60 squares.<\/li>\n<li>Distance between lines seems to be unique for each set of two cells (horizontally\/vertically).<\/li>\n<li>The slope between all lines is the same or vertically reflected, except in the few blocks with curve stitching.<\/li>\n<li>In some patterns with two filled blocks, the centerline of the pattern is darker.<\/li>\n<li>Not all blocks have a pattern.<\/li>\n<li>The probability of a block having both a vertical and a horizontal pattern on it is low.<\/li>\n<li>There is no block that is completely black.<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>My code:<\/p>\n<pre class=\"wp-block-preformatted\">import processing.svg.*;\r\n\r\nvoid setup() {\r\n  size(1200, 1200); \r\n  noLoop(); \r\n}\r\n\r\nvoid draw() {\r\n  background(255);\r\n  beginRecord(SVG, \"molnar.svg\");\r\n\r\n  stroke(0);\r\n  \/\/noStroke();\r\n  noFill(); \r\n\r\n  int nCells = 60;\r\n  rectMode(CENTER);\r\n  float x1, x2, y1, y2, rwidth, rheight;\r\n  rwidth = (width)\/ (float)(nCells+2);\r\n  rheight = rwidth; \/\/ Since it is square. \r\n  for (int row =0; row&lt;nCells; row++) {\r\n    for (int col =0; col&lt;nCells; col = col + 2) { if (random(1.0) &gt; 0.25){\r\n        x1 = rwidth + row*rwidth;\r\n        y1 = rheight + col*rheight;\r\n        x2 = rwidth + x1;\r\n        y2 = 2*rheight + y1;\r\n        fillRect(x1,y1, x2,y2,false);\r\n      }\r\n    }\r\n  }\r\n  for (int row =0; row&lt;nCells; row = row + 2) {\r\n    for (int col =0; col&lt;nCells; col++) { if (random(1.0) &gt; 0.25){\r\n        \/\/fill(0,0,0,50);\r\n        x1 = rwidth + row*rwidth;\r\n        y1 = rheight + col*rheight;\r\n        x2 = 2*rwidth + x1;\r\n        y2 = rheight + y1;\r\n        fillRect(x1,y1, x2,y2, true);\r\n      }\r\n    }\r\n  }\r\n   \r\n  endRecord();\r\n}\r\nvoid fillRect(float x1, float y1, float x2,float y2, Boolean isHorizontal){\r\n  int lineNum = int(random(2, 6)); \r\n   if (isHorizontal &amp;&amp; random(1.0) &lt; 0.05){\r\n    x2 = x1 + (x2-x1)\/2;\r\n    float horDist = x2 - x1;\r\n    for(int i = 1; i &lt; lineNum - 1; i++){\r\n      line(x2 - i*(x2-x1)\/(lineNum-1), y1, x2 , y2 - i*(y2-y1)\/(lineNum-1)); \r\n    }\r\n    x1 = x1 + horDist;\r\n    x2 = x2 + horDist;\r\n    for(int i = 1; i &lt; lineNum; i++){\r\n      line(x1, y1 + (y2-y1)*i\/(lineNum-1), x1 + (x2-x1)*i\/(lineNum-1), y1);\r\n    }\r\n    for(int i = 1; i &lt; lineNum; i++){\r\n      line(x1 + (x2-x1)*i\/(lineNum-1), y2, x2, y1 + (y2-y1)*i\/(lineNum-1));\r\n      }\r\n    x1 = x1 + horDist;\r\n    x2 = x2 + horDist;\r\n    for(int i = 1; i &lt; lineNum - 1; i++){ line(x1, y1 + i*(y2-y1)\/(lineNum-1), x1 + i*(x2-x1)\/(lineNum-1), y2); } return; } if (random(1.0) &gt; 0.5){\r\n    if (random(1.0) &gt; 0.5){\r\n    for(int i = 1; i &lt; lineNum; i++){ \/\/ line(x1, y1 + i*(y2-y1)\/(lineNum-1), x1 + i*(x2-x1)\/(lineNum-1), y2); \/\/ curvy hatch line(x1, y1 + (y2-y1)*i\/(lineNum-1), x1 + (x2-x1)*i\/(lineNum-1), y1); } } if (random(1.0) &gt; 0.5){\r\n      for(int i = 1; i &lt; lineNum; i++){ \/\/ line(x1, y1 + i*(y2-y1)\/(lineNum-1), x1 + i*(x2-x1)\/(lineNum-1), y2); \/\/ curvy hatch line(x1 + (x2-x1)*i\/(lineNum-1), y2, x2, y1 + (y2-y1)*i\/(lineNum-1)); } } }else{ if (random(1.0) &gt; 0.5){\r\n    for(int i = 0; i &lt; lineNum -1; i++){ line(x1, y1 + (y2-y1)*i\/(lineNum-1), x2 - (x2-x1)*i\/(lineNum-1), y2); } } if (random(1.0) &gt; 0.5){\r\n      for(int i = 0 ; i &lt; lineNum - 1; i++){\r\n      line(x1 + (x2-x1)*i\/(lineNum-1), y1, x2, y2 - (y2-y1)*i\/(lineNum-1));\r\n      }\r\n    }\r\n    \r\n  }\r\n  \r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><!--more--><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium\" src=\"https:\/\/cdn.discordapp.com\/attachments\/720701646077952116\/883799697146396702\/unknown.png\" width=\"600\" height=\"599\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/307"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/comments?post=307"}],"version-history":[{"count":7,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/307\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/tags?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}