Infinite Diversity, Infinite Challenges
It isn't easy to create computing exercises that are challenging, while allowing for the limited knowledge of the new programmer.
This page is devoted to a concept whereby a 'Server' program presents a challenge. The 'Server' is communicated with, by the student's program, via a simple random access file. Everything takes place within the bounds of a multi-tasking desktop environment. The process is turn based, but allows for a diverse range of exercises.
The duties of the 'Server' program are to:
Define the rules of the exercise/challenge
Create the environment
Communicate with the player program(s)
Display the results of each turn/move
Act as umpire/adjudicator
See this pdf for further details.
1. Grid Bug
While player programs can be written in any language that supports file handling, simple player source code for BB4W, relevant to single-player challenges, is provided below:
IF x>0 THEN
REM Has the 'Server' responded with a message?
IF FNgetmessage(1)="0" THEN
REM The user may read the message file in one or multiple sections
REM Player's programming solution goes here (replies into reply$)
REM Update the message file with our reply
WAIT 50:REM Wait 1/2 second
REM Retrieve a portion of the message file
FOR a=1 TO c:c$+=CHR$(BGET#x):NEXT
REM Replace the message record with our reply
FOR a=1 TO LEN(r$):BPUT#x,ASC(MID$(r$,a,1)):NEXT
Click here for the 'Lost Robot 9261' programming competition (2015).