XML

kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for loop-invariant

2011

Question 51 (2011):

Submission reference: IN2084

Hi, I'm currently doing Task 3 for the life on mars assessment. Whenever I run the program and attempt to enter a colour for the robot to find, the screen simply flashes and doesn't accept the input.

Answer 51:

This is a new improved user interface for selecting from a long list of options. Try pressing the TAB key, as the initial prompt suggests. You will be shown the legal colours and be prompted again. You will only be able to type letters that go towards those colour names. Press TAB at any time and either you will be shown remaining possible options (given what you have typed so far) or characters will be supplied for you (as far as possible towards an option, until there is a choice). If only one option is possible (given what you have typed so far), pressing TAB completes the word. Of course, you can type BACKSPACE at any time. Press SPACE or ENTER to complete your selection – this will be ignored if you still have an incomplete word.

This user interface is modelled on file and command name completion in the bash shell of Unix. It is implemented by the ask.select process defined in the "ask_select.occ" file and invoked by the mission.control process in "mars-sim.occ" (and supported by the small function in "alpha_numeric.occ"). The ask.select logic is fairly complex, but made amenable through the declaration of loop invariants (a general and extremely useful programming mechanism that can be used in any language).

Keywords: mars , loop-invariant

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:27 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.