{"id":84,"date":"2015-06-16T06:02:23","date_gmt":"2015-06-16T02:02:23","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=84"},"modified":"2015-06-16T06:02:23","modified_gmt":"2015-06-16T02:02:23","slug":"exercise-17","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-17\/","title":{"rendered":"Exercise 17"},"content":{"rendered":"<p>Improving on our bar code generator<\/p>\n<pre><code>\r\nfloat x = 0;\r\n\r\nvoid setup() {\r\n  size(400, 400);\r\n  background(255);\r\n  stroke(255);\r\n}\r\n\r\nvoid change_line_color() {\r\n  stroke(255, 0, 0);\r\n  line(x, 100, x, 200);\r\n  \/\/ now we decide if to use black or white\r\n  if (random(100) > 50) {\r\n    stroke(0);\r\n  } else {\r\n    stroke(255);\r\n  }\r\n}\r\n\r\nvoid draw() {\r\n  \/\/ draw black or white line\r\n  line(x, 100, x, 200);\r\n\r\n  \/\/ sometimes we decide to change the line color\r\n  if (random(100) > 90) {\r\n    change_line_color();\r\n  }\r\n  x = x + 1;\r\n  if (x > width) {\r\n    x = 0;\r\n  }\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Improving on our bar code generator float x = 0; void setup() { size(400, 400); background(255); stroke(255); } void change_line_color() { stroke(255, 0, 0); line(x, 100, x, 200); \/\/ now we decide if to use black or white if (random(100) > 50) { stroke(0); } else { stroke(255); } } void draw() { \/\/ draw [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":1,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/84\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}