If All the World Did Coding Rather than Sudoku – Programming, the Environmentally Friendly Puzzle

by
Flash vs Sudoku

Flash vs Sudoku

We have heard that puzzles are good to keep the brain healthy but it is too bad that all that brain power is producing nothing.

The thought of millions of people spending countless brain hours playing Sudoku, Solitaire, Crosswords, etc. makes me want to weep. Perhaps we are relaxing… but perhaps we just did not think about alternatives.

Alternatives are to turn to the puzzles of Physics, Philosophy, and Mathematics and the likes and use thinking power for the good of humanity.

Another good alternative is programming.  Programming is like a big fantastic puzzle with a solution that is useful for society. It might be a tool for creating, a social or e-learning application, an artistic exploration or visualization to help us understand the world.

Programming is the environmentally friendly puzzle – in addition to exercising your mind, your brain power produces a product!

WHAT IS IT LIKE TO PROGRAM?

In general, you apply certain techniques to solve problems. The cool thing is that while the techniques applied are similar from one feature to another, the feeling you get is really connected to what you are making. Here are the latest features I have made and you can tell that I am emotionally attached to what is being made. I feel like a sculptor, an artist, an inventor and even a wizard when I program.

BUILDING ORACLES
I have just built an oracle! It is a really cool interface that lets you drag the oracle’s eye towards certain attributes. Then based on the attributes, an answer is found. Its purpose is to find out which alien you have most in common. By building it with Object Oriented Programming it can easily be used to create soundscapes or to pick a resonating political party.

MAKING ENVIRONMENTAL STATEMENTS
A jet man who flies through beautiful clouds only to use them up to fuel his jet pack. Once a million clouds… now less. Object oriented programming let me easily extend code that someone from around the world wrote to make a JetParticle class to fly the rocket! Now you can use that class for your own rocket power – just tell it the direction and the thrust!

HELPING THE WORLD SEE SAY
YaSeeSay is currently being built and it lets you see what people are saying. Users can transcribe audio or video and time the highlight bar on the text so that others can read along. When they click the text, the audio or video jumps to that part. This one-week project has all sorts of twisty turns leading to several dozen absolutely rewarding moments! Imagine the feeling as you struggle with code and then finally having the success of click on a line of text and the audio playing – and to code it so that anyone has this power to be able to educate or entertain is so rewarding!

HOW DO I START PROGRAMMING?

Below is a rather wordy description of creating multimedia and in particular with Adobe Flash. We look at all these aspects in detail in the one year post grad Interactive Multimedia Program at Sheridan which condenses about five to ten years of experience learning on your own with books and help files plus gives you the advantage of a certificate, connections and better employment potential.

Pre-Programming

STEP 1: Determine what to make

“I want to provide buttons to make a picture flip directions”

  • This is a creative step where you find a need or imagine a story or artistic feature. There are a number of creative techniques that we teach in Interactive Multimedia to help come up with ideas. Some of these can be found at http://inventor.wordpress.com as inventing is generally an act of imagination, ingenuity and creation. If it is too hard to come up with something unique to start, then try making something you know and maybe along the way, you can add an improvement or something extra 😉 Or try something simple like showing a picture and when you click on the picture it flips.

STEP 2: Sketch what you are going to make

“Center the picture, put a logo at top and two buttons in the right corner”

  • Get a sketch book and a pack of Mirado HB pencils, and eraser and a pencil sharpener and keep them around your work area. Sketch out what you are wanting to make with little panels and flow arrows. Should just take fifteen minutes or so and will help you organize yourself. A hint for later… the arrows mean an event occurs. Something like a click to get from one state to another.

STEP 3: Make your assets

“I’ll take a picture, make the logo in Illustrator and buttons in Flash”

  • Make your assets in Photoshop, Illustrator, Flash, etc. These are pictures, illustrations, motion graphics, video, audio, MovieClips, panels, etc. Keep your audio and video and perhaps your pictures (if you have many) outside of Flash and import them dynamically. Make any static MovieClips or timeline animations in Flash in your library. You may end up making more after doing some programming but make enough to get started.

Programming

STEP 4: Set up where you are going to code

“I’ll just copy and paste the basic template in which I can start coding”

  • In Flash these days, programming is done in “Classes” (see below) in external text files with a .as extension. There is a special format with a rigid structure that is fairly complex but repeats itself so you get used to it. This format has made programming more difficult initially for people who have not programmed before. However, the structure provides for more consistency and that makes it easier in the end. In a Flash file, you provide a reference to what is called the Document Class. This Document class has a constructor and it is the constructor that will run first – so this is where we start coding!
    package project {
    	public class Project {
    		// below is the constructor
    		public function Project() {
    			// write code here
    		}
    	} // end class
    } // end package

    STEP 5: Ready your Object Oriented Programming

    “I’ll keep on reading this paragraph until I semi-understand!”

    • Flash ActionScript is an Object Oriented Programming (OOP) language which is the latest programming paradigm used by most current languages like Java, JavaScript, C#. OOP is cool because it is organized kind of like life. Every value (except null and undefined) is an Object that is made from a template called a Class. A Class is defined in a single .as file with that special format as mentioned. Common Classes are Number, String, Video, Date. There are a hundred more and you can even make your own – like a Monster Class! Classes hold Properties (attributes like color) and Methods (functions like play). For example, a Property of a String is its length and a Method is toUpperCase(). var myDate:Date = new Date(); creates a new Date Object from the Date Class and assigns the Object to a variable called myDate. We could then show the month of that date (which defaults to today’s date) by typing trace (myDate.month). Note that we can access Properties and Methods of an Object with the dot syntax. Objects can also have Events assigned to them so that, for instance, when a Button Object is clicked an Event will trigger and call some Method to set some Property. There are a couple other aspects about OOP like inheritance and encapsulation but above gets you 99% of the way there!
    Programming Constructs

    Programming Constructs

    STEP 6: Ready your language syntax!

    “Hmmm… it gives me an error unless I type it exactly right!”

    • Syntax is the format of what you type to make the ActionScript compiler understand what you want it to do. It is something that everyone struggles with at first – it is like learning a new language. There are certain language elements you are allowed to write in a certain way – you really only need to know a dozen or two to get you going. In general you write sequential statements with identifiers, operators and expressions, like: if (age >= 19) {myDrink = “beer”;} Here we have an if statement that checks an expression age > 19 and if this is true, executes the block of code between the {} to assign the String value (expression) of “beer” to the variable with the identifier myDrink. There might be multiple lines in the block of code between the {} and these would all run one after the other but they will not run if the value stored in the age variable is less than 19. Different statements let us apply programming logic as described next.

    STEP 7: Ready your programming logic

    “Ah… should the user flip the picture in two directions at once?”

    • Programming logic is what you use to enforce the rules of the environment or feature or application you are making. Here are the most common constructs: variables, which let you store values that change; conditionals, if statements that do blocks of code depending on certain conditions; functions, which let you do a block of code whenever you call it and as many times as you want; loops which repeat a block of code while a condition is true and can update a counter to help you handle repetitive tasks; and finally arrays which hold lists of data that can be accessed with index numbers. So you might have an array of pictures from Germany and an array from France. You could use a conditional to find out if we had stored France in a user-preference variable and if so loop through the France array to tile thumbnail pictures. Each time someone clicks a picture you call a function which holds a block of code that in this case makes the picture get bigger and the rest of the thumbnails fade out.

    STEP 8: Add in some interactivity

    “Oooo, now let’s make it do some cool stuff!”

    • Interactivity usually starts at the Events. Mouse clicks, rollovers, key presses, timer events, etc. And then you get to drag things, animate things and see if they hit other things! But interactivity is also between people by sharing data for instance, sharing collages, or layouts of rooms, or chats and forums, scores and positions in games. This is done by connecting Flash through server scripting – just enough to get the data back and forth! This is what makes the Internet great (or different than TV and books) – it is the sharing!

    STEP 9: Debug and test

    “Rats… when I do this and this it was supposed to do that and that!”

    • At every step of the way, you will run into problems – and it is in part these problems that make programming like a puzzle. I have coded millions of lines of code and still most bugs are unique! They fall into certain categories, yes, but I never seem to tire of the challenges they provide. I have never been thwarted – it seems that I can always find a solution but it is never so easy that I get bored. A perfect puzzle balance!

    CONCLUSION

    If you like to organize, apply intuition and efficiencies, track, plan, research and create – all these are part of solving the eternally varied puzzles of programming. The wonderful thing about the programming puzzle is that unlike Chess, Myst, Sudoku, and the likes, programming can lead to creations that society use for education, communication and entertainment. Programming is the environmentally friendly puzzle – you use your brain power to help society!

Advertisements

Tags:

11 Responses to “If All the World Did Coding Rather than Sudoku – Programming, the Environmentally Friendly Puzzle”

  1. Rick Says:

    While I love the sentiment of re-directing the brain power spent on problem solving to something more useful like programming, I can’t help but think they are two quite different things.

    Puzzles use a very small, well-defined rule set to solve them. They typically take a matter of minutes to comprehend the basic rules and start working on the puzzle. Sure there are more advanced strategies that can be applied to puzzles, they are not a requirement.

    By comparison, the amount of knowledge required to follow the 7 steps above is quite large and will take days, weeks and months to gain a basic understanding of the rules governing a particular development paradigm.

    Maybe we as programmers should look at using our programming knowledge to create applications that harness human brain power in a useful, but still accessible way.

    For example, Google is doing this with an image “game” they created that basically has users tagging images with meta data. There are numerous other examples, of games and applications that harness human power in small doses to work towards a larger end-result.

    It’s kind of like the SETI@Home project that uses thousands of small home cpu’s around the world to collectively analyze the mass amounts of data from the SETI project. How do we put passive brain power to work to solve larger problems?

    Just some more food for thought.

  2. Rick B Says:

    Interesting article. You might want to read-
    http://multimedia.md/blog/software/gamemaking-for-dummies.html
    which demonstrates how easy it is now to start programming video games.

    And another article out today related to this:
    http://www.timesonline.co.uk/tol/comment/columnists/guest_contributors/article4281768.ece

    We will all be gamers soon. Hmmm. Could playing games some day be the same thing as programming?

  3. Dan Zen Says:

    Yes… I have used the Google image tagging game as a simple example when arguing the point – I know too many Sudoku players – mind you, it is just the latest rage… it might even be over.

    Puzzles often have a few simple rules but if you break down programming into smaller tasks… each one is like a puzzle. “I need to make an ID that has both numbers and letters. And I can use a loop and an array. Go!”

    There is indeed a lot of prep before you can handle all the smaller tasks to complete the “quest”. But once you have the knowledge, the level of thinking required I think is something like that of chess. Chess has a similar number of basic elements and depth of thought – how many loose ends you have to track.

    King Queen Rook Bishop Knight Pawn
    Object Method Property Event

    Rules of movement and capture
    Rules of syntax

    Strategy of moves with options and results
    Flow strategy with conditionals and functions

    Of course with programming there are countless classes, methods, properties and events. They all come from the basic elements though. Perhaps they would equate to using words to solve crossword puzzle clues. So there are puzzles that draw on as much knowledge as programming. It is just that most people have that knowledge already and do not have the programming knowledge.

    Do you think that solving Riven was just as hard if not harder than programming?

    Making features that harness brain power for use by others is indeed a noble cause. This is what applications are. With interactive multimedia we are constantly building mediums in which others can create. Mind you it is pretty easy to build a medium. Every thought we communicate acts as a medium to explore.

    Enough late night rambling… time to put the finishing touches on YaSeeSay…. A few more interlocking puzzles to go and it will be complete!

    Thanks for the insightful comment Rick!

  4. Speaking your Ideas for Clarity, Continuity and Completion « Inventing With Dan Zen Says:

    […] that prompted YaSeeSay to be built.  It took a week of massive puzzle solving.  See the post in Interactive Multimedia that proposes programming is an environmentally friendly puzzle – one where the brain power is used for an outcome that helps society beyond just keeping brains […]

  5. News Flash: Roundup of Flash-related News (July 15, 2008) - Down the Foxhole Says:

    […] If All the World Did Flash Rather than Sudoku What if all the people that do Sudoku puzzles each day applied their brainpower to learning and executing ActionScript instead? This question is posed by Dan Zen of Sheridan Interactive Multimedia and leads nicely into a useful introduction into AS3 and object oriented programming. […]

  6. Harold Schnell Says:

    Good overview on programming Dan. This helps newbies like myself understand what is involved.

  7. PEV – Personal Energy Value in Environmental Calculations « Inventing With Dan Zen Says:

    […] minutes to turn it on.  We might even examine our past-times like what is it costing to do that Sudoko! (Yikes… not to put a damper on our relax […]

  8. PEV – Personal Energy Value in Environmental Calculations « Zenvironment Says:

    […] minutes to turn it on.  We might even examine our past-times like what is it costing to do that Sudoko! (Yikes… not to put a damper on our relax […]

  9. Zenvironment Says:

    […] MORE STORY […]

  10. If All the World Did Flash Rather than Sudoku – Programming, the Environmentally Friendly Puzzle « Zenvironment Says:

    […] MORE STORY […]

  11. Multimedia Josh Says:

    I agree. I am a fan of games like Chess, Reversi… games that need brainpower. But I also feel that they are a waste of time. I am also a flash programmer and the time spent to play Chess was used to program in flash and in the end, I had some flash games to show my friends.

    Programming is hard but worth it. Chess and Reversi are hard too and maybe worth it but not as much as productive work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: