Weekly Coding Tasks for Beginners?

I’m going to be gone all next week, so I’ve made mine early. The only worthwhile command is ‘knock back a nice hot brew’, but the game understands all the usual things, including ‘make tea’. Maybe the source code will be instructional, especially if you want to understand implicit actions…


Incidentally, a complete implementation of tea, coffee and hot chocolate facilities can be seen in Calm. [size=50](I should stress that it’s not the game’s strongest point.)[/size]

I meant having experience coders review code. However, by “experienced coder” I rather meant anyone who has an intermediate level grasp and is willing to volunteer. They don’t have to be complete pros. The way I see it, an experienced coder in this context is anyone who already understands the stuff in the weekly coding tasks already. I like to see it more as a chance for them to “stretch their wings” so to speak.

Well, enjoy your week off. :angry:

Maybe next time you should implement a pasta vending machine instead. :slight_smile:

Ah, damn! That’s really well implemented, even if it’s not pretty (i.e. no descriptions). Lots of good coding for people to nick…er, be inspired by. And without implementing liquids at all hats off - nice work. I have been making this unnecessarily difficult on myself. What kind of idiot implements heat and liquids for a weekly exercise?* Your work-around is much better - like the inform documentations says “only implement as much detail as is necessary for your game-world.” Nice work.

  • Sadly I’m too much in love with my setting to change this now.

If I was actually implementing it in a game, I’d make the whole thing a lot more straightforward, and not implementing proper water/sugar/tea/milk etc. was a step in that direction. The central conceit of the game was somewhat inspired by The Nemean Lion. I look forward to seeing everyone else’s exercises!

I think this is a very good idea and one I will follow as I continue to learn Inform 7. However, I think it would be more beneficial if the problems were targeted toward working on a specific set of programming issues, and could be ranked in difficulty. Ultimately, the best thing would be if someone very experienced developed a syllabus of problems to work through, keyed to a textbook (Reed’s, the inform manual, whatever) to practice specific skill sets.

On thing I forgot to say above is that I am willing to volunteer as an “experienced coder” on this project. Also, since it’s been a week, it’s new task time.

I have 2 ideas, I’ll leave it to you do decide whether they’re any good.

My first idea is a direction reverser code. So going north goes south instead, going south goes north instead and similarly for the other directions.

My second idea is a signpost that can be turned clockwise and anticlockwise. After the signpost is turned, the signs all point in different directions.


Cool Climbingstars. My code is probably shonky in parts, having someone look it over would be great!

I won’t be putting my code up until Friday though, sorry. Your tasks both sound challenging, not sure how the group’s gonna choose tasks…?

Well, I wasn’t too sure on how easy or hard the coding tasks should be but I believe they’re on the same difficulty level as the ones you set. I always think it’s nice to rise up to a challenge. Also, no one else seems to have offered this week’s challenges, so I thought I’d take the initiative.

Heh, after (mostly) doing the water one. I’m thinking it might be a little too hard. Glad to challenge myself though. What do others think about it?

Here’s my contribution for the Tea-making assignment!


I got way too carried away, I’m afraid… I’m not sure if the game gets lost in the details? Also my code is super klunky, so apologies in advance.

That’s really good! It’s the details that make the game. As my co-writer points out, “You can’t have interactive fiction without the fiction!”.

I noticed that you use procedural rules to ignore some of the ones already there. These are actually deprecated and it’s best to unlist or replace the rule you don’t want instead.

[code]The describe what’s on scenery supporters in room descriptions rule is not listed in any rulebook.

The can’t put onto something being carried rule is not listed in the check putting it on rulebook.

Carry out examining (this is the new examine containers rule):
if the noun is not the water-pitcher, anonymously abide by the examine containers rule.

The new examine containers rule is listed instead of the examine containers rule in the carry out examining rulebook.[/code]

Another thing I noticed is that “put cresai/yllwm/ereem/oolong in pot” gives “Which do you mean, the jar of cresai/yllwm/ereem/oolong tea or the cresai/yllwm/ereem/oolong tea-leaves?”.

I’ve come across this when making drinks code and for some reason trying to fix this with “does the player mean” rules just doesn’t work.

Overall, I’d say it’s a task well done.

As it happens, I have actually made drinks code for a game, although I find that it’s more tedious than it is difficult. My version involves make tea, coffee and hot chocolate as well as being able to add sugar and milk. Also, you can only make limited quantities of drinks before the supplies run out.

Haha! Yddo - I have an old fashioned tea ceremony in mine too. I haven’t played it through yet, but your description is much, much better than mine which has a lot of ‘blah blah blah’ blanks for descriptions later. I will finetune and upload later today. Got to finish an assignment first.

Thanks! After having a friend play through it I think I found out that the water-pitcher and the burner on which it sits are initially invisible? I need to go back and double-check… >.>


I really suck at coding. Can you guys help me with this one:

Check putting the noun on the brazier:
if the noun is not the teapot say “There will be destruction, just not here. Not now.”.

I think you want one of these two:

[code] Check putting the noun on the brazier:
if the noun is not the teapot say “There will be destruction, just not here. Not now.” instead.

Check putting the noun on the brazier:
if the noun is not the teapot:
say “There will be destruction, just not here. Not now.”;
stop the action.

By default check rules allow the action to continue, so if you want your check rule to make the action not happen you need to add one of those bits so the action stops.

[UPDATE: Edited to fix the error Emerald pointed out.]

That won’t quite work; it will stop the action no matter what item the noun is. You need to make sure that the if statement covers both the say phrase and the stop-the-action phrase, like so:

Check putting the noun on the brazier: if the noun is not the teapot: say "There will be destruction, just not here. Not now."; stop the action.

Ugh, entirely right. Shouldn’t try untested stuff early in the morning. I’ll edit my original post.

I also think it would work to put the condition in the rule heading:

Check putting something on the brazier when the noun is not the teapot: say "There will be destruction etc." instead.

Oh, and do you have to say “something” in the rule header instead of “the noun”? Maybe that’s the problem.

Thanks guys, I did manage to get that one working by stealing some code. Now all I have to do is code for a successful tea making, and to stop actions that put the wrong things in containers. Cheers!

Yeah, it wasn’t until I looked at the code that I worked out what I needed to do for that step. Nicely done though. I have been trawling through The Documentation and think this chapter about ‘scope’ might be what you’re looking for to make it visible?
17.27. Deciding the scope of something
Not sure though, as I’ve never even tried to use scope rules before.

Actually, the burner is already in scope, since you can examine it. However, it is part of the table, which is scenery, therefore the burner will also be scenery. The best way to fix this would be to have the burner be on the table and fixed in place.

Hope this helps.