The Third Annual ICFP Programming Contest FAQ

Last Changed:  Monday 7:06pm

Q: Are we required to detect runtime errors in surface functions or may we silently continue?


A:  You should detect errors like subscript out of bounds and type errors, but overflow, division-by-zero, etc. may be ignored.

Q: Can the phong exponent be negative? How do we deal with a complex result from (N dot H_j) ^ n?


A:  The phong exponent will not be negative in our tests.  The result is undefined if you are given a negative phong exponent.

Q:  Should the md5 checksum be on the tar file or the gzipped-tar file?  Also, should the md5 checksum include the filename as is output by the md5sum command on Linux or should it just have the sum?


A:  The md5 checksum should be on the gzipped-tar file.  The checksum you put in your mail message should not include the filename.  Rather, it should look something like this “c3bad6bc1db9ff6bdd4e21bb7400121c”.

Q:  Is it legitimate to statically reject programs containing unbound variables even if such uses are unreachable at run time?


A:  Yes.

Q:  If there is an error in the input, must we silently exit with non-zero status or may we also produce text on stdout or stderr?


A:  You may print anything you like on stdout or stderr.

Q:  Can I exit with error, if I have “5 0 divi” in the program even in a function which will never get evaluated or should I raise the error only when evaluating the expression?


A:  If the function never gets evaluated, then you shouldn’t raise an error.  E.g., “true { } { 5 0 divi } if” should never cause an error.

Q:  What is the precise meaning of depth?


A:  If depth = 0, then there are no specular reflection rays (i.e., the component contributed from the S direction).  You still need to compute the diffuse and specular illumination from lights at depth 0.

Q: What is the behavior for a ray hitting an object where the origin of the ray is within the object? Does the ray continue to the outside of the object or does it reflect back inside?


A: This situation can arise in two ways: the model placed the viewer inside an object, or rounding error caused a shadow or reflected ray's origin to slip inside an object.  In the former case, you can either cull the surface or flip the normal; we will not test for it.  In the latter case, you need to make sure that the ray is not obstructed by its originating surface.

Q: I gather that colours, intensities will (normally) be in the range 0 to 1, but the ppm file uses values 0 to 255. So do I take it that we need to "clampf" the intensities and then scale them to the range 0-255?


A:  That’s right.

Q: I'm not sure if I understand the illumination equation correctly. I gather that C, I_s, I_j and I_a are all triples (eg RGB values).  Is this correct?  And if so, do the expressions I_j C, I_S C, I_a C denote component-wise multiplication and that thus I is a triple?


A:  Yes.  I (the intensity) is a vector of the resulting intensities for the red, green, and blue components. We represent intensities as “points” with x corresponding to red, y to green, and z to blue.  You compute the intensity for each component independently.  Thus, to compute the red component of I, you would use only the red components of I_s, I_j, etc.

Q:  You don’t give any types for the arguments to the light primitives.  What are they?


A:  You're right.  The directions and colors should definitely be points (see the sample code.)   The cutoff and the exp are reals.

Q:  Is it all right to print messages on stdout while executing?  (If it is, I don’t need to remove my debugging stuff.)


A:  Yes, it’s fine.

Q:  Can we open temporary files in /tmp?  Can we open files anywhere?


A:  You can open temporary files in /tmp or in the directory that we place your code. 

Q:  What should we do in a Tier-1 implementation if we see a Tier-2/3 operator?  Signal an error?


A:  That would be nice, but we’re not going to test this.

Q:  The requirements state, "The second phase tests the basic correctness of submissions (without regards to performance). We will use a selection of Tier-1 test cases and compare the output with that generated by our sample implementations. Submissions that deviate significantly from the reference outputs will be disqualified." We're wondering what "deviate[s] significantly" means... any difference in the output file?  any visible difference? or a major visible difference? (like "Oops, that sphere is in the wrong place") We're curious about this for some time-saving routines we're contemplating.


A: We'll be using relatively simple statistical tests, such as calculating the median distance of each pixel (in color space) from the reference image.  So minor roundoff differences in placement or color should have little effect.  (Our two reference implementations, developed independently and in different languages, agree almost pixel-for-pixel with each other.)


Q:  What is the rounding behavior of modi? 


A:  We'll follow a couple of other languages and require that "n1 n2 modi" results in a value n3 such that n3 is the remainder of the division of n1 by n2 and has the same sign as n1 n2.  (Note:  I had a bug here previously and wrote n2 instead of n1.)  So, the following should hold (for n2<>0):


  (n1 / n2) * n2 + (n1 mod n2) = n1


Q:  With respect to the eye position at (0,0,-1) and the image plane being the XY plane, does this imply that object surfaces in front of the "image plane" (for the viewer) are treated differently from surfaces behind the "image plane"? Or does it simply mean that the direction of view (for the centre of the image) is the +Z direction?


A:  The latter;  objects between the view position and the image plane should be rendered.

Q:  Is there a bug in the definition of the surface of a sphere? 


A:  There was a bug in version 1.10 and earlier of the task description.  We should have that fixed by version 1.11.

Q:  Are newlines allowed in strings?


A:  Strings are made up of printable characters according to C’s isprint() except for double quotes (“).  This includes all ASCII characters between 0x20 (space) and 0x7E (~).  So carriage returns and linefeeds are not allowed in strings.  We are unlikely to test this sort of thing.  We’re much more likely to test that the basic arithmetic works as described.

Q:  Are the Tier 2+ operators reserved words in a Tier 1 program?


A:  Yes. 

Q:  The `render' operation takes eight parameters.  The specification is not entirely clear about the requirements on the types of those arguments.  For example, must `ht' and `wid' be integers? Or are reals OK too? Likewise can the `fov' argument be an integer, or must it be a real? Does the `file' argument have to be a string? Does `amb' have to be a color? Does the `render' operation push anything on the stack?


A:  The ht and wid arguments must be integers, the fov argument must be a real, the file argument must be a string, and the amb argument must be a color, etc.  The render operation should not leave anything on the stack.

Q:  Does frac map –1.2 to –0.2?


A:  Yes. 

Q:  Is render only valid at top level or can it (a) be called inside a loop (say), (b) be called from inside a callback (say a surface definition?)


A:  Yes, render is valid inside a loop.  However, a call to render inside a surface definition function is undefined.  The intention is to allow a number of images to be generated by the same basic scene construction. 


Q:  Can a space (‘ ‘) be a character in a string? 


A:  Yes.  (Previously I said no, but spaces can be in strings!)   Any character accepted by C’s isprint() is allowed in strings.

Q:  There appears to be a bug in the definition of divi/divf.  It says that both the numerator and denominator are n1.


A:  Yes, the bug is fixed in version 1.5 of the task.htm document.  The description should read:  computes the quotient n3 by dividing the number n1 by the number n2.”

Q:  Is it permissible to implement [ and { by pushing a mark on the stack and having ] and } pop down to it (as in Postscript).


A:  Perhaps, but note that “[ /x” is an illegal program.

Q:  Is input guaranteed to follow the grammar rules, and if not, then are we required to issue a diagnostic on faulty input?


A:  See the second paragraph of section 4.

Q:  Do tokens have to be separated by whitespaces or are things such as {}[] self-delimiting? How should “6f” be lexed?


A:  Tokens do not have to be separated by white space when it is unambiguous.  Whitespace is not allowed in numbers or (obviously) identifiers.  So, for example, “6f” would lex as two separate tokens, a number (6) and an identifier (f).

Q:  In an array, can you do calculations while forming the array?  (e.g., [2 3 addi 10 7 subi ] => [5 3])

A:  Yes.  See rule 6 in Figure 2.

Q:  There seems to be a bug in the factorial example at the end of section 2.7. 

A:  You’re right – there was a bug.  The last line of 2.7 should’ve read “12 fact fact apply”.  Version 1.4 of the Task has the update.

Q:  Are true and false keywords or are we allowed to rebind them?

A:  true and false are keywords.

Q: Is it an error to use Integers instead of Reals or vice versa?  For example, can I write "1 2.0 addf" or "1.0 2.5 addi"?

A:  You must explicitly convert integers to reals and vice versa.  So both of the examples above are illegal.

Q: Are identifiers case-sensitive?

A: Yes.

Q:  You specify real numbers should be represented using 64-bit (double) IEEE representation.  What should the precision for integers be and should we worry about overflow or divide by zero?

A:  To accommodate different language implementations, we'll be pretty loose here.  Your integers should support at least 24 bits worth of precision.  The output of a GML program is undefined if either integer overflow or division by 0 occurs.

Q:  What pre-existing libraries are we allowed to use?  

A:  Anything that's legal.  That is, you shouldn't ship us any code for which you do not have a legal license.  

Q: Which characters terminate a line in a GML program?  

A:  A carriage return, linefeed, carriage return/linefeed pair, a vertical tab, or the end of a file terminate a line.  The task.htm document has been updated to reflect this clarification.

Q: Is the array subscripting operation "get" or "sub"?  The example in the array section indicates one thing, but the text and table indicate another.

A:  The array subscripting operation is "get".  The task documents have been updated to reflect the change.

Q: Can I use my favorite language?

A: The short answer is "as long as you can produce a statically linked executable".  The longer answer is that you can submit several support executables (such as an interpreter for your favorite language) and script to run them. See the submission page for more details.

Q: Will you install my language on your test machines?

A: We'd like to, but for testing purposes we've already burned a CD of a stable machine configuration. However, it's not really necessary that your language be installed on the testing machine (see the above question).  We only installed languages in case there are problems (we'll try to do some simple debugging if we also have the source).

Back to the ICFP Programming Contest Main page.