Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,77 +1,77 @@
|
|||
repeat forever
|
||||
repeat forever
|
||||
put random(1111,9999) into num
|
||||
if character 1 of num is not equal to character 2 of num
|
||||
if character 1 of num is not equal to character 3 of num
|
||||
if character 1 of num is not equal to character 4 of num
|
||||
if character 2 of num is not equal to character 3 of num
|
||||
if character 2 of num is not equal to character 4 of num
|
||||
if character 3 of num is not equal to character 4 of num
|
||||
if num does not contain 0
|
||||
exit repeat
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set description to "Guess the 4 digit number" & newline & "- zero's excluded" & newline & "- each digit is unique" & newline & newline & "Receive 1 Bull for each digit that equals the corresponding digit in the random number." & newline & newline & "Receive 1 Cow for each digit that appears in the wrong position." & newline
|
||||
repeat forever
|
||||
repeat forever
|
||||
Ask "Guess the number" title "Bulls & Cows" message description
|
||||
put it into guess
|
||||
if number of characters in guess is equal to 4
|
||||
exit repeat
|
||||
else if guess is ""
|
||||
Answer "" with "Play" or "Quit" title "Quit Bulls & Cows?"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set score to {
|
||||
bulls: {
|
||||
qty: 0,
|
||||
values: []
|
||||
},
|
||||
cows: {
|
||||
qty: 0,
|
||||
values: []
|
||||
}
|
||||
}
|
||||
repeat the number of characters in num times
|
||||
if character the counter of guess is equal to character the counter of num
|
||||
add 1 to score.bulls.qty
|
||||
insert character the counter of guess into score.bulls.values
|
||||
else
|
||||
if num contains character the counter of guess
|
||||
if character the counter of guess is not equal to character the counter of num
|
||||
if score.bulls.values does not contain character the counter of guess and score.cows.values does not contain character the counter of guess
|
||||
add 1 to score.cows.qty
|
||||
insert character the counter of guess into score.cows.values
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set showScores to "Your score is:" & newline & newline & "Bulls:" && score.bulls.qty & newline & newline & "Cows:" && score.cows.qty
|
||||
if guess is not equal to num
|
||||
Answer showScores with "Guess Again" or "Quit" title "Score"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
else
|
||||
set winShowScores to showScores & newline & newline & "Your Guess:" && guess & newline & "Random Number:" && num & newline
|
||||
Answer winShowScores with "Play Again" or "Quit" title "You Win!"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
repeat forever
|
||||
put random(1111,9999) into num
|
||||
if character 1 of num is not equal to character 2 of num
|
||||
if character 1 of num is not equal to character 3 of num
|
||||
if character 1 of num is not equal to character 4 of num
|
||||
if character 2 of num is not equal to character 3 of num
|
||||
if character 2 of num is not equal to character 4 of num
|
||||
if character 3 of num is not equal to character 4 of num
|
||||
if num does not contain 0
|
||||
exit repeat
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set description to "Guess the 4 digit number" & newline & "- zero's excluded" & newline & "- each digit is unique" & newline & newline & "Receive 1 Bull for each digit that equals the corresponding digit in the random number." & newline & newline & "Receive 1 Cow for each digit that appears in the wrong position." & newline
|
||||
repeat forever
|
||||
repeat forever
|
||||
Ask "Guess the number" title "Bulls & Cows" message description
|
||||
put it into guess
|
||||
if number of characters in guess is equal to 4
|
||||
exit repeat
|
||||
else if guess is ""
|
||||
Answer "" with "Play" or "Quit" title "Quit Bulls & Cows?"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set score to {
|
||||
bulls: {
|
||||
qty: 0,
|
||||
values: []
|
||||
},
|
||||
cows: {
|
||||
qty: 0,
|
||||
values: []
|
||||
}
|
||||
}
|
||||
repeat the number of characters in num times
|
||||
if character the counter of guess is equal to character the counter of num
|
||||
add 1 to score.bulls.qty
|
||||
insert character the counter of guess into score.bulls.values
|
||||
else
|
||||
if num contains character the counter of guess
|
||||
if character the counter of guess is not equal to character the counter of num
|
||||
if score.bulls.values does not contain character the counter of guess and score.cows.values does not contain character the counter of guess
|
||||
add 1 to score.cows.qty
|
||||
insert character the counter of guess into score.cows.values
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
set showScores to "Your score is:" & newline & newline & "Bulls:" && score.bulls.qty & newline & newline & "Cows:" && score.cows.qty
|
||||
if guess is not equal to num
|
||||
Answer showScores with "Guess Again" or "Quit" title "Score"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
else
|
||||
set winShowScores to showScores & newline & newline & "Your Guess:" && guess & newline & "Random Number:" && num & newline
|
||||
Answer winShowScores with "Play Again" or "Quit" title "You Win!"
|
||||
put it into myAnswer
|
||||
if myAnswer is "Quit"
|
||||
exit all
|
||||
end if
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
end repeat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue