-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRetroBooting.fprg
88 lines (88 loc) · 4.69 KB
/
RetroBooting.fprg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0"?>
<flowgorithm fileversion="3.0">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="yogen"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2023-01-19 12:02:51 AM"/>
<attribute name="created" value="eW9nZW47REVTS1RPUC1JU0Y0UURFOzIwMjMtMDEtMTI7MDI6NDg6NTggUE07MjkwNw=="/>
<attribute name="edited" value="YWpheXI7QUpBWTsyMDIzLTAxLTE1OzAzOjQ2OjUxIFBNOzY7MjIxOA=="/>
<attribute name="edited" value="eW9nZW47REVTS1RPUC1JU0Y0UURFOzIwMjMtMDEtMTc7MDQ6MDA6MDYgUE07MTt5b2dlbjtERVNLVE9QLUlTRjRRREU7MjAyMy0wMS0xMzswMzo0MDo1MCBQTTtqa2prLmZwcmc7NjkxNw=="/>
<attribute name="edited" value="eW9nZW47REVTS1RPUC1JU0Y0UURFOzIwMjMtMDEtMTc7MDQ6MTg6NDEgUE07MTg7MzA2Nw=="/>
<attribute name="edited" value="TmlzaGl0aCBQO0xBUFRPUC1WSzhUNE5MTjsyMDIzLTAxLTE5OzEyOjAyOjUxIEFNOzg7MzMwNg=="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<call expression="initGame()"/>
</body>
</function>
<function name="getFileContents" type="String" variable="content">
<parameters>
<parameter name="fileName" type="String" array="False"/>
</parameters>
<body>
<declare name="content, line" type="String" array="False" size=""/>
<assign variable="line" expression="" ""/>
<assign variable="content" expression=""""/>
<open expression="fileName" mode="read"/>
<while expression="!EOF()">
<read variable="line"/>
<assign variable="content" expression="content&line&ToChar(10)"/>
</while>
<close/>
</body>
</function>
<function name="initGame" type="None" variable="score">
<parameters/>
<body>
<declare name="answer, option, ans, score, i" type="Integer" array="False" size=""/>
<declare name="temp, content" type="String" array="False" size=""/>
<assign variable="content" expression="getFileContents("game.txt")"/>
<declare name="flag" type="Boolean" array="False" size=""/>
<assign variable="score" expression="0"/>
<assign variable="flag" expression="false"/>
<assign variable="i" expression="0"/>
<assign variable="temp" expression=""""/>
<for variable="i" start="0" end="len(content)-1" direction="inc" step="1">
<while expression="ToCode(char(content,i))!=10">
<assign variable="temp" expression="temp&char(content,i)"/>
<assign variable="i" expression="i+1"/>
</while>
<if expression="temp=="-- BEGIN QUESTION --"">
<then/>
<else>
<if expression="temp="-- END QUESTION --"">
<then>
<assign variable="flag" expression="true"/>
</then>
<else>
<if expression="flag=true">
<then>
<assign variable="ans" expression="toInteger(temp)"/>
<input variable="option"/>
<if expression="option == ans">
<then>
<output expression=""Correct Answer!"" newline="True"/>
<assign variable="score" expression="score+1"/>
</then>
<else>
<output expression=""Nope"" newline="True"/>
</else>
</if>
<assign variable="flag" expression="false"/>
</then>
<else>
<output expression="temp" newline="True"/>
</else>
</if>
</else>
</if>
</else>
</if>
<assign variable="temp" expression=""""/>
</for>
<output expression=""----------"&toChar(13)&"Your score is "&score&"!"" newline="True"/>
</body>
</function>
</flowgorithm>