Code Sketch
Hexanet
By: Anusha Pant
0


0




size(900, 900) cleari() initRandomGenerator(-4773392619599392335L) originBottomLeft() setBackground(black) val tileCount = 4 val tileSize = cwidth / tileCount def circ(n : Boolean,size: Double) = Picture { var a = 1 if (n) { a = -1 } setPenThickness(3) for (i <- 1 to random(20, 55)) { setPenColor(randomColor) repeat(6) { forward(5 + i*5) right(a * 60) } left(a * 90) hop(5) right(a * 90) hop(-2.5) } } def shape = trans(tileSize/2, tileSize/2) -> circ(randomBoolean ,0.5 * tileSize) def block(posX: Double, posY: Double) { val pic = shape pic.setPosition(posX, posY) pic.setPenColor(randomColor) draw(pic) } repeatFor(rangeTill(0, cheight, tileSize)) { posY => repeatFor(rangeTill(0, cwidth, tileSize)) { posX => block(posX, posY) } }





Your Comment:





Login to post a comment