We’ve all done it… we’ve wasted way too much time writing an overly complex class just to create a simple square/roundrect button. Who has the nicest one? Post a link to yours (googlecode, wonderfl, etc…).
I’ve always avoided wasting too much time writing one of these but just spent 2 hours writing an overly complex one… looking forward to the way that people have done it….
For instance, did you make your class dynamic? Did you use scale9? did you use CSS? etc… Just curious how complex have gotten with it.
Write code that pulls saturated moving colors from a web cam… that is… if you move a red coffee cup across the screen your code should capture the color red.
A few hints: frame differencing, hsb and get/setVector.
I’ll post my working version tomorrow or the next day… this is a challenging one so I may give an extra day before I post my solution….
Today's quiz is not multiple choice. Instead, your task is to write a lisp style math parser. This may sound tricky, but it's surprisingly simple. (well... not simple exactly, it's just simple compared to what one might assume).
Lisp uses prefix notation... where the operator is placed before the operands:
10 * 10
becomes:
* 10 10
You could think of this as a function "*" with two arguments (10, 10). In Lisp this is enclosed with parens:
(* 10 10)
Let's see a few more examples:
100 / 2 + 10
becomes:
(+ (/ 100 2) 10)
...
2 * 4 * 6 * 7
becomes:
(* 2 4 6 7)
...
(2 + 2) * (10 - 2) * 2
becomes
(* (+ 2 2) (- 10 2) 2)
Remember, thinking "functions" really helps. The above can be though of as:
multiply( add(2, 2), subtract(10 , 2), 2)
You should create a function called parsePrefix() that takes a string and returns a number:
Here is some code to test if your parser works properly: