new org test
This commit is contained in:
@@ -3,18 +3,13 @@
|
||||
|
||||
* Project 1: Guess A Number (Task 1)
|
||||
|
||||
** Table of Contents :toc:
|
||||
- [[#project-1-guess-a-number-task-1][Project 1: Guess A Number (Task 1)]]
|
||||
- [[#about-this-task][About this task]]
|
||||
- [[#solution][Solution]]
|
||||
|
||||
** About this task
|
||||
|
||||
*** Project overview
|
||||
|
||||
The goal of the first project is to program a simple number guessing game: the player needs to correctly guess a number, chosen from an interval $$\[1,N \]**, with at most $$K$$ guesses.
|
||||
The goal of the first project is to program a simple number guessing game: the player needs to correctly guess a number, chosen from an interval $\[1,N \]$, with at most $K$ guesses.
|
||||
|
||||
In the lecture, a first version of the game was presented, in which the player had only one chance of guessing the correct number. In order to implement the full game, you will have to extend this version by allowing the player to guess up to $$K$$ times.
|
||||
In the lecture, a first version of the game was presented, in which the player had only one chance of guessing the correct number. In order to implement the full game, you will have to extend this version by allowing the player to guess up to $K$ times.
|
||||
|
||||
The first project consists of two tasks: *task 1* /(this task)/ is to reimplement the first version of the game that was presented in the lecture, *task 2* is to implement the full game.
|
||||
|
||||
@@ -24,7 +19,7 @@ Develop your program step-by-step, and save, run and compile it often. I.e. impl
|
||||
|
||||
*** Fulfilling requirements and testing programs
|
||||
|
||||
A particular goal of this task is to make you understand how strongly connected requirements and testing (and thus grading submissions) are. E.g. if the task description requires output of the shape "I␣saw␣$$n$$␣cat(s).", where $$n$$ is a number and ␣ represents blanks/whitespaces, your program will not be considered correct if it outputs a text that is "basically the same", but does not precisely match the requirements. E.g. the following outputs, while very close to the expected output, do not match the shape specified above: "i␣saw␣3␣cat(s).", "I␣saw␣3␣cats.", "I␣saw␣1␣cat.", "I␣saw␣2␣cat(s)" and "i␣saw␣2␣␣cat(s)␣.".
|
||||
A particular goal of this task is to make you understand how strongly connected requirements and testing (and thus grading submissions) are. E.g. if the task description requires output of the shape "I␣saw␣$n$␣cat(s).", where $n$ is a number and ␣ represents blanks/whitespaces, your program will not be considered correct if it outputs a text that is "basically the same", but does not precisely match the requirements. E.g. the following outputs, while very close to the expected output, do not match the shape specified above: "i␣saw␣3␣cat(s).", "I␣saw␣3␣cats.", "I␣saw␣1␣cat.", "I␣saw␣2␣cat(s)" and "i␣saw␣2␣␣cat(s)␣.".
|
||||
|
||||
Meeting such requirements precisely is necessary for testing: we automatically (at least to some extent) test correctness of your programs by comparing the expected output to the output produced by your program. Since these comparisons are performed by a computer, it is much much easier to do them syntactically, i.e. letter-by-letter.
|
||||
|
||||
@@ -35,7 +30,7 @@ However, being able to precisely fulfil requirements is more generally important
|
||||
To solve this task, proceed as follows:
|
||||
|
||||
1. Look at the template program, in particular main.cpp, and see what's already there (e.g. variable declarations) and what's still missing. The latter is hinted at by TODO comments.
|
||||
1. The template already contains code for picking the number to guess. By default, the number is randomly choosen from the interval $$\[1,3\]$$:
|
||||
1. The template already contains code for picking the number to guess. By default, the number is randomly choosen from the interval $\[1,3\]$:
|
||||
|
||||
#+begin_src cpp
|
||||
number_to_guess = choose_a_number(3);
|
||||
|
Reference in New Issue
Block a user