Tag creative programming

Code a Week #3: More Wittgenstein

Again did not have very much time to code and after coding mostly in C for arduino etc. I do find Java & Javascript (the p5.js) to not really fit into my way of thinking. I do still enjoy it and this week I mostly ported the first week’s scipt into vectors. Inspired again (a lot) by Shiffmans Nature of Code-book. It is a recommendable book, if you have some background on programming and Object-oriented programming. Not the most clearly written, but fun. He has done a video tutorials also, which are a joy to watch. Anyway this weeks code might not work on mobile devices that well, as it does track your mouse position. But who knows if it miraculously detects your touch also… (Did not code that into it, altough p5.js has support for touch controls.) And it’s a one minute loop on the text part. So stick around for the finale..   Wittgenstein and certainty:

show code

void thought1(){ int m = second(); if (m >5 && m <25 ){ fill(0); text("I act with complete certainty. But this certainty is my own.",100,250); } else { fill(255); text("I act with complete certainty. But this certainty is my own.",100,250); } } void thought2(){ int m = second(); if (m >27 && m <55 ){ fill(0); text("At the core of all well-founded belief lies belief that is unfounded.",100,50); } else { fill(255); text("At the core of all well-founded belief lies belief that is unfounded.",100,50); } } class Mover { PVector location; PVector velocity; PVector acceleration; float topspeed; Mover() { location = new PVector(width/2, height/2); velocity = new PVector(0, 0); topspeed = 10; } void update() { acceleration = PVector.random2D(); acceleration.mult(random(2)); velocity.add(acceleration); velocity.limit(topspeed-int(random(10))); location.add(velocity); } void display() { fill(255,50); noStroke(); rect(0,0,640,360); fill(10); ellipse(location.x, location.y, 5, 5); } void checkEdges() { if (location.x > width) { location.x = 0; } else if (location.x < 0) { location.x = width; } if (location.y > height) { location.y = 0; } else if (location.y < 0) { location.y = height; } } } class Follower { PVector location2; PVector velocity2; PVector acceleration2; float topspeed2; Follower() { location2 = new PVector(random(width),random(height)); velocity2 = new PVector(0,0); topspeed2 = 4; } void update2() { PVector mouse = new PVector(mouseX,mouseY); PVector dir = PVector.sub(mouse,location2); dir.normalize(); dir.mult(0.5); acceleration2 = dir; velocity2.add(acceleration2); velocity2.limit(topspeed2); location2.add(velocity2); } void display2() { noStroke(); fill(255,0,0,100); ellipse(location2.x,location2.y,4,4); } void checkEdges2() { if (location2.x > width) { location2.x = 0; } else if (location2.x < 0) { location2.x = width; } if (location2.y > height) { location2.y = 0; } else if (location2.y < 0) { location2.y = height; } } } Mover mover; Follower[] follower = new Follower[20]; void setup() { PFont myFont; myFont = createFont("Georgia", 12); textFont(myFont); size(640,360); mover = new Mover(); for (int i = 0; i < follower.length; i++) { follower[i] = new Follower(); } background(255); } void draw() { thought1(); thought2(); mover.update(); mover.checkEdges(); mover.display(); for (int i = 0; i < follower.length; i++) { follower[i].update2(); follower[i].checkEdges2(); follower[i].display2(); } }[/p5js]

Algorithmic creation: Unbearable thinnes of flatness?

I recently read Christopher Steiners: Automate This: How Algorithms Came to Rule Our World (2012) which is a good overview of how computer algorithms have become commonplace in most unusual places. 

Steiner starts his journey with the 2010 flash crash in Wall Street, when Dow Jones suddenly lost over trillion dollars of it’s value in one day. Which is by the far the largest single loss ever recorded. Reason for this loss was a bug in one of the automated trading algorithms. Steiner then expands to the history of algorithms and how they took over stock trading and how they are now taking over many other areas, like entertainment industry, medical and health care industry. Steiner’s book is a good introduction on algorithms and their importance in our lives. The book got me thinking about algorithms in culture creation, where they are also already utilized.

Read More