|
| 1 | +<?xml version="1.0"?> |
| 2 | +<flowgorithm fileversion="2.11"> |
| 3 | + <attributes> |
| 4 | + <attribute name="name" value=""/> |
| 5 | + <attribute name="authors" value="Nicholas Bennett"/> |
| 6 | + <attribute name="about" value=""/> |
| 7 | + <attribute name="saved" value="2019-01-23 09:30:34 PM"/> |
| 8 | + <attribute name="created" value="TmljaG9sYXMgQmVubmV0dDtOQi1JTlNQSVJPTi0xNTsyMDE5LTAxLTIzOzExOjQyOjIwIEFNOzM3ODg="/> |
| 9 | + <attribute name="edited" value="TmljaG9sYXMgQmVubmV0dDtOQi1JTlNQSVJPTi0xNTsyMDE5LTAxLTIzOzA5OjMwOjM0IFBNOzc7MzkyNg=="/> |
| 10 | + </attributes> |
| 11 | + <function name="Main" type="None" variable=""> |
| 12 | + <parameters/> |
| 13 | + <body> |
| 14 | + <while expression="playOneRound()"/> |
| 15 | + <output expression=""Thanks for playing!"" newline="True"/> |
| 16 | + </body> |
| 17 | + </function> |
| 18 | + <function name="inputAndCheck" type="Boolean" variable="playing"> |
| 19 | + <parameters> |
| 20 | + <parameter name="secret" type="Integer" array="False"/> |
| 21 | + </parameters> |
| 22 | + <body> |
| 23 | + <declare name="playing" type="Boolean" array="False" size=""/> |
| 24 | + <assign variable="playing" expression="false"/> |
| 25 | + <output expression=""What is your guess (1-100, 0 to give up)?"" newline="True"/> |
| 26 | + <declare name="guess" type="Integer" array="False" size=""/> |
| 27 | + <input variable="guess"/> |
| 28 | + <if expression="guess == 0"> |
| 29 | + <then> |
| 30 | + <output expression=""You gave up!"" newline="True"/> |
| 31 | + </then> |
| 32 | + <else> |
| 33 | + <if expression="guess == secret"> |
| 34 | + <then> |
| 35 | + <output expression=""Correct!"" newline="True"/> |
| 36 | + </then> |
| 37 | + <else> |
| 38 | + <if expression="guess < secret"> |
| 39 | + <then> |
| 40 | + <output expression=""Your guess of " & guess & " is too low."" newline="True"/> |
| 41 | + </then> |
| 42 | + <else> |
| 43 | + <output expression=""Your guess of " & guess & " is too high."" newline="True"/> |
| 44 | + </else> |
| 45 | + </if> |
| 46 | + <assign variable="playing" expression="true"/> |
| 47 | + </else> |
| 48 | + </if> |
| 49 | + </else> |
| 50 | + </if> |
| 51 | + </body> |
| 52 | + </function> |
| 53 | + <function name="playOneRound" type="Boolean" variable="playAgain"> |
| 54 | + <parameters/> |
| 55 | + <body> |
| 56 | + <declare name="secret" type="Integer" array="False" size=""/> |
| 57 | + <assign variable="secret" expression="1 + Random(100)"/> |
| 58 | + <while expression="inputAndCheck(secret)"/> |
| 59 | + <output expression=""The secret number was " & secret & "."" newline="True"/> |
| 60 | + <output expression=""Play again (y/n)?"" newline="True"/> |
| 61 | + <declare name="userResponse" type="String" array="False" size=""/> |
| 62 | + <input variable="userResponse"/> |
| 63 | + <declare name="playAgain" type="Boolean" array="False" size=""/> |
| 64 | + <assign variable="playAgain" expression="Len(userResponse) > 0 && (Char(userResponse, 0) == "y" || Char(userResponse, 0) == "Y")"/> |
| 65 | + </body> |
| 66 | + </function> |
| 67 | +</flowgorithm> |
0 commit comments