June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -2,7 +2,7 @@ file f;
|
|||
integer n;
|
||||
text s;
|
||||
|
||||
f_affix(f, "/dev/stdin");
|
||||
f.stdin;
|
||||
|
||||
n = irand(1, 10);
|
||||
o_text("I'm thinking of a number between 1 and 10.\n");
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
:begin
|
||||
SET /A rand=%random% %% (10 - 1 + 1)+ 1
|
||||
SET guess=
|
||||
SET /P guess=Pick a number between 1 and 10:
|
||||
set /a answer=%random%%%(10-1+1)+1
|
||||
set /p guess=Pick a number between 1 and 10:
|
||||
:loop
|
||||
IF "!guess!" == "" (
|
||||
EXIT
|
||||
)
|
||||
SET /A guess=!guess!
|
||||
IF !guess! equ !rand! (
|
||||
ECHO Well guessed^^!
|
||||
EXIT
|
||||
)
|
||||
SET guess=
|
||||
SET /P guess=Nope, guess again:
|
||||
GOTO loop
|
||||
if %guess%==%answer% (echo Well guessed!
|
||||
pause) else (set /p guess=Nope, guess again:
|
||||
goto loop)
|
||||
|
|
|
|||
21
Task/Guess-the-number/Elena/guess-the-number.elena
Normal file
21
Task/Guess-the-number/Elena/guess-the-number.elena
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import extensions.
|
||||
|
||||
program =
|
||||
[
|
||||
int randomNumber := randomGenerator eval(1,10).
|
||||
console printLine("I'm thinking of a number between 1 and 10. Can you guess it?").
|
||||
bool numberCorrect := false.
|
||||
until(numberCorrect)
|
||||
[
|
||||
console print("Guess: ").
|
||||
int userGuess := console readLine; toInt.
|
||||
if (randomNumber == userGuess)
|
||||
[
|
||||
numberCorrect := true.
|
||||
console printLine("Congrats!! You guessed right!")
|
||||
];
|
||||
[
|
||||
console printLine("That's not it. Guess again.").
|
||||
]
|
||||
].
|
||||
].
|
||||
17
Task/Guess-the-number/HolyC/guess-the-number.holyc
Normal file
17
Task/Guess-the-number/HolyC/guess-the-number.holyc
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
U8 n, *g;
|
||||
|
||||
n = 1 + RandU16 % 10;
|
||||
|
||||
Print("I'm thinking of a number between 1 and 10.\n");
|
||||
Print("Try to guess it:\n");
|
||||
|
||||
while(1) {
|
||||
g = GetStr;
|
||||
|
||||
if (Str2I64(g) == n) {
|
||||
Print("Correct!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
Print("That's not my number. Try another guess:\n");
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
function guess()
|
||||
number = rand(1:10)
|
||||
print("Guess my number! ")
|
||||
while(readline(STDIN) != string(number))
|
||||
print("Nope, try again! ")
|
||||
end
|
||||
println("Well guessed!")
|
||||
number = dec(rand(1:10))
|
||||
print("Guess my number! ")
|
||||
while readline() != number
|
||||
print("Nope, try again... ")
|
||||
end
|
||||
println("Well guessed!")
|
||||
end
|
||||
|
||||
guess()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import random
|
||||
target, guess = random.randint(1, 10), 0
|
||||
guess = int(input("Guess a number that's between 1 and 10: "))
|
||||
while target != guess:
|
||||
guess = int(input("Guess again! "))
|
||||
t,g=random.randint(1,10),0
|
||||
g=int(input("Guess a number that's between 1 and 10: "))
|
||||
while t!=g:g=int(input("Guess again! "))
|
||||
print("That's right!")
|
||||
|
|
|
|||
|
|
@ -1,17 +1,23 @@
|
|||
while true
|
||||
see "Hey There,
|
||||
========================
|
||||
I'm thinking of a number between 0 and 10, Can you guess it??
|
||||
Guess :> "
|
||||
give x
|
||||
n = random(10)
|
||||
if x = n see "
|
||||
**********************************************
|
||||
** Thats right You Are Genius :D **
|
||||
**********************************************
|
||||
"
|
||||
exit
|
||||
else
|
||||
see "Oops its not true, Try again please :)" + copy(nl,3)
|
||||
ok
|
||||
### Bert Mariani
|
||||
### 2018-03-01
|
||||
### Guess_My_Number
|
||||
|
||||
myNumber = random(10)
|
||||
answer = 0
|
||||
|
||||
See "Guess my number between 1 and 10"+ nl
|
||||
|
||||
while answer != myNumber
|
||||
See "Your guess: "
|
||||
Give answer
|
||||
|
||||
if answer = myNumber
|
||||
See "Well done! You guessed it! "+ myNumber +nl
|
||||
else
|
||||
See "Try again"+ nl
|
||||
ok
|
||||
|
||||
if answer = 0
|
||||
See "Give up. My number is: "+ myNumber +nl
|
||||
ok
|
||||
end
|
||||
|
|
|
|||
9
Task/Guess-the-number/VBA/guess-the-number.vba
Normal file
9
Task/Guess-the-number/VBA/guess-the-number.vba
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Sub GuessTheNumber()
|
||||
Dim NbComputer As Integer, NbPlayer As Integer
|
||||
Randomize Timer
|
||||
NbComputer = Int((Rnd * 10) + 1)
|
||||
Do
|
||||
NbPlayer = Application.InputBox("Choose a number between 1 and 10 : ", "Enter your guess", Type:=1)
|
||||
Loop While NbComputer <> NbPlayer
|
||||
MsgBox "Well guessed!"
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue