Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
30
Task/24-game/LiveCode/24-game-2.livecode
Normal file
30
Task/24-game/LiveCode/24-game-2.livecode
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
on keyDown k
|
||||
local ops, nums, allowedKeys, numsCopy, expr
|
||||
put "+,-,/,*,(,)" into ops
|
||||
put the text of fld "YourNumbersField" into nums
|
||||
put the text of fld "EvalField" into expr
|
||||
if matchText(expr & k,"\d\d") then
|
||||
answer "You can't enter 2 digits together"
|
||||
exit keyDown
|
||||
end if
|
||||
repeat with n = 1 to the number of chars of expr
|
||||
if offset(char n of expr, nums) > 0 then
|
||||
delete char offset(char n of expr, nums) of nums
|
||||
end if
|
||||
end repeat
|
||||
put ops & comma & nums into allowedKeys
|
||||
if k is among the items of allowedKeys then
|
||||
put k after expr
|
||||
delete char offset(k, nums) of nums
|
||||
replace comma with empty in nums
|
||||
try
|
||||
put the value of merge("[[expr]]") into fld "AnswerField"
|
||||
if the value of fld "AnswerField" is 24 and nums is empty then
|
||||
answer "You win!"
|
||||
end if
|
||||
end try
|
||||
pass keyDown
|
||||
else
|
||||
exit keyDown
|
||||
end if
|
||||
end keyDown
|
||||
Loading…
Add table
Add a link
Reference in a new issue