Posts Tagged ‘ programming ’

Brief update

Nothing new this week, unless I come up with something on the fly.  I’m knee-deep in figuring out ethics applications for directed study/thesis research, something I basically need to get done ASAP if I plan on doing any sort of data collection or analysis before the end of the term. I’ve also completed most of the response/review paper assignments required for my courses.

To make life more complicated, some database workshops related to my HUCO course this term have renewed my desire to do a bit of coding.  I’ve been toying with the idea of starting a simple PHP/mySQL project– unrelated to coursework– to refresh my memory and hone my (admittedly limited) programming skills. More on that, possibly, if anything comes of it.

You will also notice I’ve changed the look of the blog once more.  It needed a bit of a facelift.

Pseudocoding: Introducing the Pizzalgorithm

This was a fun exercise I had in an assignment as intro to programming, and I thought I’d share.

Phase 2: Problem Solving

Tasks:

1) Write an algorithm to tell a computer how to deal with traffic lights. Use only if, else

if, and/or else.

IF (the light is green) { PROCEED }

ELSE IF (the light is yellow) { SLOW DOWN }

ELSE IF (the light is red) { STOP }

2) Write an algorithm describing your morning routine from waking up to work/school.

Use if, else if, else, and loops.

WHILE (alarm goes off AND clock reads earlier than 7:00) {

Hit ‘Snooze’ ;

}

ELSE  put on glasses AND fall out of bed

IF (on floor AND have no shirt AND have no pants) {

Feel around;

IF (feel shirt) { pick it up } ;

IF (feel pants) { pick it up } ;

Crawl to dresser {

Grab clean underwear AND socks ;

IF (have no shirt) { grab one clean shirt } ;

IF (have no pants) { grab clean pair of pants } ;

}

Stand ;

}

Smell self

IF (stinky) {

go shower;

dry off;

put on underwear;

put on socks;

put on pants;

put on shirt;

}

ELSE IF (slight smell OR fresh as a daisy) {

put on underwear;

put on socks;

put on pants;

put on shirt;

}

IF (not in bathroom) { go to bathroom }

IF (in bathroom) {

have bowel movement;

brush teeth;

WHILE (hair is unruly AND clock reads earlier than 7:45) {

run fingers through hair;

};

WHILE (clock reads later than 7:45 AND earlier than 8:15) { check email }

IF (clock reads 8:15) {

put on jacket;

go catch bus;

}

3) Write 2 algorithms of your choice.

Bonus: Write an algorithm for writing algorithms.

Continue reading