LOL I was bored so I made this (credits to srl helpers for helping me with this, doing strtoint)
It's actually not bad.. lol
Simba Code:
Program Game;
{$i srl/srl.simba}
const
RANDOM_PICK = 100;
NUMBER_OF_GUESS = 10;
var
Number,Tries:Integer;
Guess:String;
Procedure LostGame;
begin
Writeln('Sorry, you lost, you guessed ' + IntToStr(Tries) + ' times, you finished with a total score of ' + IntToStr(RANDOM_PICK/50) + ' points')
end;
Procedure DisplayResults;
begin
if (StrToInt(Guess)) > Number then
begin
IncEx(Tries, 1);
ClearDebug;
Writeln('Your number ' + (Guess) + ' is higher than the correct number. ');
Writeln('You have ' + IntToStr(NUMBER_OF_GUESS - Tries) + ' tries Left.')
Wait(700);
end;
if (StrToInt(Guess)) < Number then
begin
IncEx(Tries, 1);
ClearDebug;
Writeln('Your number ' + (Guess) + ' is lower than the correct number. ');
Writeln('You have ' + IntToStr(NUMBER_OF_GUESS - Tries) + ' tries Left.')
Wait(700);
IncEx(Tries, 1);
end;
if (StrToInt(Guess)) = Number then
begin
ClearDebug;
Writeln('Winner! you finished with a total score of ' + IntToStr((RANDOM_PICK*10)-(Tries*5)) + ' points!');
TerminateScript;
end;
if Tries >= NUMBER_OF_GUESS then
begin
LostGame;
end;
end;
Procedure AskGuess;
begin
If (InputQuery('Guess number between 0 and ' + IntToStr(RANDOM_PICK), 'Number[Between 0 and ' + IntToStr(RANDOM_PICK) + ']', Guess)) Then
begin
DisplayResults;
end;
end;
Procedure PickNumber;
begin
Number := Random(RANDOM_PICK);
AskGuess;
end;
Begin
PickNumber;
repeat
Askguess;
until Tries >= NUMBER_OF_GUESS;
end.