1
0
Fork 0
mirror of https://gitlab.com/niansa/pilang2.git synced 2025-03-06 20:49:22 +01:00
pilang2/examples/guessinggame.pil
2020-05-30 15:37:57 +02:00

31 lines
1.2 KiB
Text

#This file is part of pilang.
#
#pilang is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#pilang is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with pilang. If not, see <https://www.gnu.org/licenses/>.
catch true
set number,4
print "Guess the first number..."
marker set,mainloop
set guess,$input "Guess a number: "
cmp equal,$~guess,,"marker goto,mainloop"
cmp isnotnum,$~guess,0,"print That's not a number. Retry with a number!","marker goto,mainloop"
cmp bigger,$~guess,$~number,"print Retry with a lower number!","marker goto,mainloop"
cmp smaller,$~guess,$~number,"print Retry with a higher number!","marker goto,mainloop"
print "You guessed it! It's ",$~number,!
print "Now guess another number..."
inc asint,number,7
marker goto,mainloop