Debugging anf Errors

411 Oct '24 | The CMP Blog | Noah Read

Topics / Concepts
Creating your own functions
random()
translate()
pushMatrix() and popMatrix()
Saving images
Debugging
println()

Resources:

Chapter 9 in Reas, C. and Fry, B. (2015) Getting Started with Processing, O’Reilly

‘Debugging’ in Shiffman, D. (2015) Learning Processing, Elsevier Science & Technology

‘Learning Processing’ video tutorials, The Coding Train, Daniel Shiffman, available at: https://thecodingtrain.com/tracks/learning-processing

Best thing I've ever leant: the term 'bug' actually comes from when an actual but got trapped inside an analogue calculator, causing it to malfunction. Thank you, Chris.

We looked at various types of bugs, from mistyped syntax errors to 404 web pages, and then to generated art like NFTs. We took pieces of code and debugged them to make them into working processing sketches. I spent a LONG time trying to make a sketch that would let the user draw on a mouse click, but not get bigger or smaller as they drew, and would not put random massive splurges on every initial click.

Floaty Dots
It is difficult to get a screenshot of the floaty dot as, by definition, it is floaty and sinks below the surface before I was able to capture it. As the code shows on line 20, commenting out the background allows the user to draw, like so:
This was as close as I could get to a working 'drawing' code, but, as you may be able to tell, it does still slightly pull inwards from the direction of the last point before the click. You can see the slightly out turned tops of letter, and especially in the top left corner of the mouth.

Panda
Speaking of generative art, we also looked at using Generative AI to help with coding. The following code was originally written by ChatGPT, but had some serious de-bugging to do. The main issue was that, although it can write code almost perfectly, it can't actually see what it's doing, and has to rely on logic. I went though several iterations of code before landing on this one and moving the eyes and ears around until it did actually look like a panda.
Back to Top