Originally post on my blog
Hello everyone! Today one colleague and friend of mine, Gaetan, would like to propose you a simple (or not) concept!
It's a code of which you are the story teller!
"Whaaaaat?"
Let me explain! We propose you to tell a story (a little one), sentence by sentence. Each time a sentences is selected, we will try to express the story into code.
An exemple is worth 1000 speech so here is the start of our story:
"Once upon a time, a young knight name Bob found a penny!"
#[derive(Debug)]
struct Story {
pub time: &'static str,
pub main_character: Character,
}
#[derive(Debug)]
struct Character {
pub name: &'static str,
pub money: i32,
}
fn found_a_strange_penny(character: &mut Character) {
character.money += 1;
println!("Oh a penny! \" said {}.\"", character.name);
}
fn main() {
let mut story = Story {
time: "Once upon a time",
main_character: Character {
name: "Bob",
money: 0,
},
};
found_a_strange_penny(&mut story.main_character);
}
All the code will live in this repository.
So, it's up to you, reader, to continue the story.
Post a comment with one sentence or two and we will try to code that.
We will choose the comment that appeal us the most!
Start :p
--
Gaetan and Mathieu
Top comments (6)
Bob ran back to his knight friend, Joe, to discuss what to do with Bob’s newfound fortune.
(Following from Julian Chen's comment)...
"You should invest the penny in the Sheriff of Nottingham's Bank," said Joe.
(Following from Jason's comment)
Bob replied "But I already have invested money in the bank, I want to buy a horse!".
(Following from Valentin Silvestre)...
"The shiny thing belongs to me" said the dragon, when it caught up to Bob.
Following from Faizan Rabbani's comment)
AND THEN A DRAGON IS FLYING TOWARD BOB AND BOB RUN TIL STAMINA DOWN
(sorry, I'm a bad game master..)
(Following from Sauban's comment)
Out of breath, Bob replied "Never! Founders keepers, you Reptilebug!"