Project 3 - 1

My first idea was to create a "Pick a path" book, where at the end of each page 2 choices are given, and each choice leads to a different page, to continue the plot.
http://i289.photobucket.com/albums/ll227/mulletsareyum/goosebumps.jpgGoosebumps is an example

Like If/else, there are always 2 options. If 'A' happens, B happens. If 'A' is not chosen/completed, 'C' happens. In the book, the charater must make a decision, where there are 2 possible outcomes. The event that forced the decision is 'A', and the 2 possible outcomes are 'B' and 'C'.

I am only going to look at the cose code, rather than the many iterations you could have.
The core code is

if (A){
B;
} else {
(C);
}

We could insert the story into the code.

if (Betty goes into the bedroom) {
Go to page 23;
} else {
(Go to page 6);
}

To help me with writing this story, I discovered a Google Labs product called Breadcrumb.





This program makes it easy to view where I am at with the story, and makes it easy to plan out.












----

I am going to alter the story and there for the coding will change to outline if/else better by including chain multiple rules in the code.

eg


if(i < 35) {
    line( 30, i, 80, i );
  } else if (i < 65) {
    line( 20, i, 90, i );
  } else {
    line( 0, i, 100, i ); 
  }
}


To achieve this in my story I would have to have a dead end after each page. So the code will be...

if (Betty chooses choice A get directed to page 12) {
die on page 12;
}else (Get directed to page 35 and choose choice A){
get directed to page 22 and die on page 22;
}else (Get directed to page 31 and choose choice A){
get directed to page 4 and die on page 4;
}else (Get directed to page 2 and choose choice A){
get directed to page 18 and die on page 18;
}else (Get directed to page 29 and choose choice A){
get directed to page 8 and die on page 8;
}else (Get directed to page 45 and WIN)}


 

To push the metaphor further I need to have a goal at the end of the book, like the if/else statement - there is something that it needs to achieve.
With such a high death rate in the above proposed code, aim of the book will be to stay alive.








0 comments

Post a Comment