initial upload

This commit is contained in:
Harald Pichler 2013-08-16 13:21:06 +02:00 committed by Ralf Schlatterbeck
parent decc9fcb0f
commit d85ce4b42b
16 changed files with 2088 additions and 0 deletions

View file

@ -0,0 +1,43 @@
// $uf10(); // LED OFF
// $uf11(); // LED ON
// $uf12(); // LED Toggle
global points;
global num;
global dbg;
function main()
{
points = 0;
// get next random number
num = $uf0();
}
function play(guess)
{
if (guess != num) {
if (guess < num) {
// hint to user: try larger numbers
$uf1(+1);
points = points - 1;
$uf11(); // LED ON
}
if (guess > num) {
// hint to user: try smaller numbers
$uf1(-1);
points = points - 1;
$uf10(); // LED OFF
}
} else {
// level up!
// LED ON
$uf11();
points = points + 10;
$uf2();
num = $uf0();
$uf10(); // LED OFF
}
// report points
$uf3();
}