The Book of Softcode Challenges

The Book of Softcode Challenges javelin Wed, 2006-08-16 22:08

Welcome to the Book of Softcode Challenges!

The goal of this book is to present a set of projects for softcoding in a graduated order of difficulty/challenge. The idea is that a new softcoder could undertake each of these challenges in order and develop new skills by learning the techniques necessary for doing each.

You can contribute to this book in several ways!

You can write a challenge page, and try to clearly outline a project for a coder to do. Please specify your estimate of the difficulty of this project as:

You can comment on a challenge page to make suggestions to improve it.

You can even post softcode snippets or entire objects that meet the challenge, as examples to others.

Javelin will edit things into their proper order and organization in this book.

Go to it!

Beginner projects

Beginner projects javelin Mon, 2006-09-04 21:07

The projects in this section are designed to teach very basic softcode concepts.

Fix yourself

Fix yourself Trispis Mon, 2006-09-04 21:22

Most MUSHes create players relatively "blank" and homogenous. The goal of this challenge is to make your player work better.

  1. Set a description on yourself so that other players see something when they look at you.
  2. Set an alias for yourself so that other players can page you with a nickname
  3. Set your sex so that game messages can be adapted to your player's gender
  4. Figure out what flags are set on your player, and what other flags you might want to set. For example, do you want other player's to be able to give you objects? Do you want to see ANSI color?
  5. If your MUSH has chat channels, find out what they are and join one.
  6. When you have found a place that you want to use as your home, set your home there.

Some help files related to this challenge are:

  • @name - in case you didn't like the name you used when creating your character
  • @alias - for your (preferably shorter) 'nickname'
  • @describe - what is displayed when someone looks at you
  • @sex - your gender
  • @lock - lots of files here, try to find out what's relevant to your player (this large family of files will carry over into nearly all subsequent challenges, don't worry about learning all of it in one sitting - it's probably the largest family of related files on the game and pretty much effects all things - take it slow and easy here, just find what you need for THIS challenge)
  • flags, flag list, @set, ANSI, COLOR, LINK_OK - learn about flags
  • @link, home - for when you find a LINK_OK room for your home
  • @channel, @chat - for the chat channels

This coding challenge by: Trispis

Potted plant

Potted plant Trispis Mon, 2006-09-04 21:08

Challenge: Create a potted plant.

The potted plant should be an object that can be looked at, picked up, and dropped. When a player interacts with the plant in one of these ways, it should give appropriate feedback to the player. For example:

> get potted plant

You carefully pick up a potted plant.

> drop plant

That might break it, so you set it down gently instead.

Other players in the same room should also see messages for the interactions, such as:

"Trispis sets down a potted plant."

Relevant help files for this challenge are:

  • @create - to create a THING (see also, types of objects)
  • @describe - for setting what is seen when it's looked at.
  • @succ, @osucc - what is seen when it's picked up
  • @drop, @odrop - what is seen when it's put down/dropped

Challenged proposed by: Trispis

Advance beginner projects

Advance beginner projects javelin Mon, 2006-09-04 21:17

These projects are designed for those who've mastered beginning mush skills, but have little coding experience.

Player-only portal

Player-only portal Trispis Mon, 2006-09-04 21:18

The goal of this challenge is to create an exit that allows PLAYERs to pass through, but prevents THINGs from passing through.

The exit should have an appropriate description. A player passing through the exit should get feedback, as should other observers on either side of the exit. A thing failing to pass through the next should cause observers to get feedback on the attempt.

*Extra Challenge*: Allow players and Puppets, but no other things, to pass.

Relevant help files:

  • @dig, @open, @link
  • @lock, locktypes, types of objects
  • @succ and @drop family, @fail family

I think the challenge can easily be done with the above. If you want to dabble with various types of locks (rather than flag or object type locks), consider an evaluation lock - here are some initial pointers for help files relevant to an evaluation type of lock...

  • types of objects, type(), hastype() - for the basic challenge
  • hasflag() - optional for the puppet challenge
  • boolean functions, or(), and()

This coding challenge by: Trispis

Intermediate projects

Intermediate projects javelin Mon, 2006-09-04 21:30

These projects are designed for coders with some experience. They are intended to help introduce less common or more powerful functions and coding idioms.

Softcoded comsystem

Softcoded comsystem javelin Mon, 2006-09-04 21:31

The goal of this challenge is to create a softcoded communications system that involves a single object with a single channel. You may assume that this object will be placed in a zone master room, and all the players using it will be in rooms in that zone. Another way to look at this challenge is that you're creating a way for players to shout across a zone.

The object should allow people to join or leave the channel. Players who have joined the channel should be able to send messages on the channel, which should be heard by all other players on the channel. Players should also be able to get a list of all the players who are on the channel.

*Extra Challenge*: Handle regular messages as speech, but handle messages starting with a colon (:) as remote poses.

*Extra Challenge*: Add a second chat channel, and do it in way that would make it easy to add more channels. Players should be able to do everything with the second that they could with the first, and should also be able to get a list of all the channels in the system.

This coding challenge by: Talvo

Repeatable Timer Loop System

Repeatable Timer Loop System elraver Tue, 2008-01-22 21:18

The object of this challenge is to create a function system that uses a stopwatch style timer similar to standard wait() command.

However, it should be universal (Accepting any input for either of the styles of running the system shown below), cleanly repeatable in a looping fashion, and finish cleanly.

Thus, you should be able to do either:
Repeat '[pemit(%#,[time()])]' every 15 minutes for the next 2 hours, then stopping the loop cleanly.
After running '@eval [setq(1,0)]'

Repeat '[setq(1,[add(%q1,1)])]' every 5 minutes until %q1 = 10, then stopping the loop cleanly.

Both of these things should be able to be done by the user, utilizing your system.

Potentially useful commands/functions you may or may not wish to consider: @wait, @notify, @drain, @trigger, @halt, until(), while(), secs(), time(), convsecs(), convtime(), timefmt(), @function (wizhelp for that one)

Extra Challenge: Create the system to only need one function for either of the styles of use.

Extra Challenge: Allow the system to work either as a function or added @command.

Extra Challenge: Perform the challenge without use of @halt.


Advanced intermediate projects

Advanced intermediate projects javelin Mon, 2006-09-04 21:46

These challenges involve larger or trickier projects that require coordination of multiple objects.


Radios javelin Mon, 2006-09-04 21:47

The goal of this challenge is to produce a set of radio (or walkie-talkie) objects that are multichannel, multicast devices -- each radio may be tuned to a single frequency at a time, and will receive any broadcast made on the same frequency.

A radio object is different from a chat channel because it is an *object* that can be given, dropped, etc. The radio should have three volume levels: off (nothing received is broadcast), normal (anything received is emitted to the location of the radio, which may be a player), and loud (anything received is emitted to the location of the radio and to the container of the location of the radio).

*Extra challenge*: Make a scanner that can receive multiple frequencies.

*Extra challenge*: Add an encryption system to the radios so that if an encryption key is set, other radios receive garbled text unless they have same encryption key set. The garbled text, ideally, should not be random but text that would actually be susceptible to (human) cryptanalysis.

This coding challenge by: Javelin

The Slim Shady Algorithm

The Slim Shady Algorithm javelin Sat, 2006-09-09 13:04

The goal of this challenge is to implement the Slim Shady Algorithm.

Create a dozen or so listening objects that all exhibit similar responses to a trigger phrase ("Will the real Slim Shady please stand up?"). The responses should be triggered in a probabilistic fashion (e.g., when asked to stand up, there is a 50% chance that each object will stand up). These are the imposter Slim Shadys.

Create a single listening object with the same response to the trigger, but 90% of the time. This is the real Slim Shady.

Create an object that repeatedly asks for the real slim shady to please stand up, and keeps track of which objects respond how often. This object should repeat the algorithm and provide its best guess of which of the standing objects is the real Slim Shady.

Expert projects

Expert projects javelin Thu, 2006-09-14 09:28

This section includes challenges for expert softcoders. These typically reflect complex "systems-level" projects.

Slimmer and Shadier

Slimmer and Shadier Trispis Mon, 2006-10-02 18:48

Totally pointless challenge of the day.

Write a fractal snapshot display. Capture a 'snapshot instant' of your fractal's evolution, and display it in some kind of "tie died" -looking display.