Last active
December 4, 2020 10:26
-
-
Save tomaes/8868532aab19fcafc75ff427ae753aab to your computer and use it in GitHub Desktop.
A population quiz game in moreorless.io style (Commodore Plus/4 version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 rem _,/'%%&&&&&&&&&&&&&&&&&%%'\__ | |
1 rem ((_country pop plus/4 version_)) | |
2 rem \_\%%%%%%%%%%%%%%%%%%%%%%%/_/ | |
7 : : | |
8 : v$ = "v1.2f, May/June 2020" : | |
9 : : | |
10 rem init ''''''''''''''''''''''; | |
11 vol 5: n=20 | |
12 dim c$(n),c(n),hi$(6),di(6) | |
13 dim ac$(n),ao$(n),ap(n),aa(n) | |
14 di(0)= 2: di(1)= 6: di(2)=8 | |
15 di(3)=10: di(4)=14: di(5)=n: od=3 | |
16 di$(5)="guru": di$(4)="hard": di$(3)="doable" | |
17 di$(2)="easy": di$(1)="kids": di$(0)="dummy" | |
18 color 0,7,1: color 4,7,1: print chr$(14) | |
19 gosub 600 | |
20 : | |
21 rem hiscore init, read data | |
22 for i = 0 to 5 | |
23 hi$(i)="No Rating yet": next | |
24 for i = 0 to n-1 | |
25 read d1$, d2$, d3, d4 | |
26 ac$(i) = d1$: ap(i) = d3 | |
27 ao$(i) = d2$: aa(i) = d4 | |
28 next | |
29 : | |
30 rem call settings menu ---- | |
33 gosub 200 | |
34 : | |
35 rem filter as needed ------ | |
36 for i = 0 to n-1 | |
37 c$(i) = ac$(i): c(i) = ap(i) | |
38 if oo = 1 then c$(i) = ao$(i) | |
39 if oa = 1 then c(i) = aa(i) | |
40 next | |
45 : | |
50 rem retry point ---------------------------------------------------------- | |
51 color 1,8,7: print | |
52 if oa = 0 then print "Where do more people live?" | |
53 if oa = 1 then print "What territory is bigger?" | |
54 print "Get ready!" | |
56 for i=0 to 1999: next | |
58 tj = ti: r = 0 | |
59 : | |
60 rem round cont ----------------------------------------------------------- | |
61 r = r+1 | |
62 p = int(rnd(1)*di(od)) | |
63 q = int(rnd(1)*di(od)): if p = q then 63 | |
64 : | |
65 sound 1,700 + int(r/5)*20, 10 | |
66 print: color 1,4,7 | |
67 print str$(r)". ";: if ot = 0 then print "[a] "; | |
68 color 1,2,7 :print c$(p); :color 1,4,7 | |
69 print " vs. ";: if ot = 0 then print "[b] "; | |
70 color 1,2,7: print c$(q);: color 1,8,7 | |
71 ok=0 | |
72 if ot=1 then print:input ">";a$:else do: get a$: loop until a$="a"ora$="b" | |
73 if ot = 1 and a$ = c$(p) then a$="a": ok=1 | |
74 if ot = 1 and a$ = c$(q) then a$="b": ok=1 | |
75 if ot = 1 and ok = 0 then print " Fatal Typing!": goto 80 | |
76 if a$ = "a" and c(p)>c(q) then print " "chr$(186)" OK!": goto 60 | |
77 if a$ = "b" and c(q)>c(p) then print " "chr$(186)" Yep": goto 60 | |
78 : | |
79 rem game over ------------------------------------------------------------ | |
80 color 1,11,7 :print " X Fault!" | |
81 sound 1, 200, 20 | |
82 : | |
83 color 1,4,7 | |
84 print: print "> "c$(p)":"str$(c(p))"M vs "c$(q)":"str$(c(q))"M" | |
85 : | |
86 print: t = (ti-tj) / 60 | |
87 print "Time total:"t"sec." | |
88 print "Time/Round:"t/r"sec." | |
89 r$ = "D": sound 1, 400, 20 | |
90 if r > 5 and t < r*8 then sound 1, 300, 20: r$ = "C (zZz)" | |
91 if r > 10 and t < r*4 then sound 1, 500, 20: r$ = "B (Alright)" | |
92 if r > 20 and t < r*3 then sound 1, 600, 20: r$ = "A (Well done!)" | |
93 if r > 30 and t < r*2 then sound 1, 800, 20: r$ = "* (Impressive!)" | |
94 if r > 99 and t < r*3 then sound 1, 899, 20: r$ = "! (Amazing!)" | |
95 print "Rating: ";: color 1,2,7: print r$: color 1,4,7 | |
96 if r$<hi$(od) then hi$(od)=r$: print "New best rating in '";di$(od);"'" | |
97 print: input "Retry (same config) or restart (y/n)";a$ | |
98 if a$ = "y" then goto 50: else gosub 600: goto 30 | |
99 : | |
200 rem welcome header ------------------------------------------------------ | |
235 color 1,5,7: print " >> "; | |
236 color 1,8,7: print "Country Pop (Plus/4 version)" | |
237 color 1,5,7: print " ...a frantic geography quiz <<" | |
260 : | |
300 rem settings menu ------------------------------------------------------- | |
303 print: color 1,14,7 | |
305 print "Settings >";: color 1,4,7 | |
306 print "Type the words in quotes.": print "." | |
310 print chr$(235)" Input: '";: if ot = 1 then color 1,2,7 :else color 1,4,6 | |
315 print "Typing";: color 1,4,6 : print "' vs. slamming '"; | |
316 if ot = 0 then color 1,2,7 :else color 1,4,6 | |
317 print "Keys";: color 1,4,6 : print"'": color 1,4,7 | |
318 : | |
320 print chr$(235)" Modes: '";: if oa = 0 then color 1,2,7 :else color 1,4,6 | |
321 print "People";: color 1,4,6 : print "' vs. '"; | |
322 if oa = 1 then color 1,2,7 :else color 1,4,6 | |
323 print "Area";: color 1,4,6 : print "'": color 1,4,7 | |
324 : | |
329 print chr$(235)" Style: '";: if oo = 1 then color 1,2,7 :else color 1,4,6 | |
330 print "Olympics";: color 1,4,6: print "' vs. '"; | |
331 if oo = 0 then color 1,2,7 :else color 1,4,6 | |
332 print "Country";: | |
333 color 1,4,6 : print "' names": color 1,4,7 | |
334 print chr$(235)" Skill: '";: if od = 4 then color 1,2,7 :else color 1,4,6 | |
337 print "hard";: color 1,4,6 : print "','"; | |
338 if od = 3 then color 1,2,7 :else color 1,4,6 | |
339 print "doable";:color 1,4,6 : print "','"; | |
340 if od = 2 then color 1,2,7 :else color 1,4,6 | |
341 print "easy";: color 1,4,6 : print "','"; | |
342 if od = 1 then color 1,2,7 :else color 1,4,6 | |
343 print "kids";: color 1,4,6 : print "'" | |
344 : | |
345 a$=chr$(192): color 1,6,7 | |
346 print chr$(237)a$a$a$a$a$a$"> 'play' vs. 'exit' or 'info'" | |
347 a$="": print: input ">";a$ | |
348 : | |
350 if a$ = "Olympics"then oo = 1 | |
351 if a$ = "Country" then oo = 0 | |
352 if a$ = "Typing" then ot = 1 | |
353 if a$ = "Keys" then ot = 0 | |
354 if a$ = "People" then oa = 0 | |
355 if a$ = "Area" then oa = 1 | |
356 if a$ = di$(5) then od = 5 | |
357 if a$ = di$(4) then od = 4 | |
358 if a$ = di$(3) then od = 3 | |
359 if a$ = di$(2) then od = 2 | |
360 if a$ = di$(1) then od = 1 | |
361 if a$ = di$(0) then od = 0 | |
362 if a$ = "info" then gosub 700 | |
363 if a$ = "col1" then color 0, 7,1: color 4, 7,1: goto 347 | |
364 if a$ = "col2" then color 0,10,1: color 4,10,1: goto 347 | |
365 if a$ = "col3" then color 0,12,1: color 4,12,1: goto 347 | |
366 if a$ = "play" then return | |
368 if a$ = "tutorial"then gosub 666 | |
369 if a$ = "ver" then print: print v$: goto 347 | |
370 if a$ = "list" then gosub 380 | |
371 if a$ = "help" then print "hint: CapiTaliZe!": goto 347 | |
372 if a$ = "best" then gosub 750 | |
374 if a$ = "load" then gosub 770 | |
375 if a$ = "save" then gosub 780 | |
376 if a$ = "exit" or a$="x" or a$="q" then 400 | |
377 if a$ = "" then 347 | |
378 goto 300 | |
379 : | |
380 rem country listing ------------------------------------- | |
382 color 1,2,7: print | |
383 print "Country" tab(13) "IOC" tab(21) "Pop." tab(30) "Area" | |
385 color 1,5,7 | |
386 for i=0 to n-1 | |
388 print "> "ac$(i) tab(12) "(" ao$(i) ")"; | |
389 print using " ###.#"; ap(i); : print using " #.####"; aa(i) | |
392 next | |
393 color 1,2,7: print "press key": do: geta$: loop until a$<>"" | |
394 return | |
396 : | |
399 rem quit ------------------------------------------------ | |
400 color 1,1,0 : rem text (org) | |
401 color 0,2,7 : rem main (org) | |
402 color 4,15,6 : rem frame (org) | |
403 char ,0,24, chr$(142) + "bye!" | |
404 end | |
405 : | |
408 rem 2020 stats -------------------- | |
409 rem - country --- ioc -- pop - area | |
410 data "Brazil", "BRA", 212.6, 8.52 | |
412 data "Germany", "GER", 83.8, 0.36 | |
420 data "Italy", "ITA", 60.5, 0.30 | |
422 data "Cuba", "CUB", 11.3, 0.11 | |
430 data "Canada", "CAN", 37.7, 9.98 | |
432 data "S. Korea", "KOR", 51.3, 0.10 | |
440 data "Argentina","ARG", 45.2, 2.78 | |
442 data "Egypt", "EGY", 102.3, 1.00 | |
450 data "Sweden", "SWE", 10.1, 0.45 | |
452 data "Oman", "OMA", 5.1, 0.31 | |
460 data "Jordan", "JOR", 10.2, 0.09 | |
462 data "Fiji", "FIJ", 0.9, 0.018 | |
470 data "Mongolia", "MGL", 3.3, 1.56 | |
472 data "Botswana", "BOT", 2.4, 0.58 | |
480 rem -------------------------------- | |
500 data "Burundi", "BDI", 11.9, 0.029 | |
502 data "Uzbekistan","UZB", 33.5, 0.45 | |
504 data "Nepal", "NEP", 29.1, 0.15 | |
506 data "Panama", "PAN", 4.3, 0.08 | |
508 data "Malta", "MLT", 0.44, 0.0003 | |
510 data "Sri Lanka", "SRI", 21.4, 0.066 | |
550 : | |
599 rem boot logo ------------------------------------------------------------ | |
600 print | |
601 color 1, 3,4: print" %%% %%% %% %% %%% %%%%% %%% % % P"; | |
602 color 1,10,5: print"%% %% %% %% %% %% %% %%% %% % %%% O"; | |
603 color 1, 8,7: print"%%%% %%%%% %%% %% %% %%% %% % % P"; | |
610 color 1, 3,7 | |
612 for i=0 to 4 step 2: print chr$(192)"-";: next: color 1, 9,7 | |
614 for i=0 to 9 step 2: print chr$(192)"-";: next: color 1,11,7 | |
616 for i=0 to 23 step 2: print chr$(192)"-";: next | |
618 for i=0 to 5: sound 1,780+int(sin(i*.05)*100),3: next | |
620 : | |
624 return | |
626 : | |
666 rem "tutorial" ----------------------------------------------------------- | |
668 print: color 1,2,7 | |
670 print "Type out the alphabet" | |
671 print "...as fast as possible!" | |
672 color 1,8,7: print "> ";: i = 0 | |
680 get a$: if a$="" then 680 | |
682 print a$;: if asc(a$)=65+i then i=i+1:sound 1,500+i*10,2: if i<26 then 680 | |
684 if i = 26 then print " < ": color 1,4,7: print chr$(186)" Done!": return | |
686 print "?!" | |
688 print " ...better luck next time!"i"/ 26": a$="": return | |
690 : | |
700 rem info ------------------------------------------------- | |
702 print: color 1,2: print "Country Pop Plus/4, the story" | |
703 print: color 1,4 | |
704 print "After playing moreorless.io and" | |
705 print "looking at the Worldometers tables" | |
706 print "once too often, a micro game in BASIC" | |
707 print "emerged and from that a mini game for" | |
708 print "C64, that was ported to Plus/4, and" | |
709 print "further to the C128 ...and back again!" | |
711 print | |
712 print: color 1,2: print "...some additional keywords to try" | |
713 print: color 1,4 | |
714 print "'colx' (x=1..3)", "change background" | |
716 print "'ver'",, "show version" | |
717 print "'tutorial'", "typing experience" | |
718 print "'list'",, "country data" | |
719 print "'best'",, "hi-score list" | |
721 print "'load','save'", "hi-score load/save" | |
722 print "'x' or 'q'", "quick exit": print | |
723 color 1,2,7: print "press key" | |
724 a$="": do: get a$: loop until a$<>"" | |
725 return | |
730 : | |
750 rem hiscore ---------------------------------------------- | |
752 color 1,2: print: print "skill","best rating" | |
753 color 1,4 | |
754 for i=0 to 5: print di$(i), hi$(i): next | |
756 return | |
758 : | |
760 rem load/save best ratings ---------------- | |
770 open 1, 8, 4, "country pop hi,s,r" | |
772 for i=0 to 5 | |
774 : input#1, hi$(i): next | |
776 close 1 | |
778 goto 790 | |
780 open 1, 8, 4, "@:country pop hi,s,w" | |
782 for i=0 to 5 | |
784 : print#1, hi$(i): next | |
788 close 1 | |
790 open 1,8,15 | |
792 input#1,ff$,fe$,fd$,fc$ | |
794 print "drive status:"; fe$ | |
796 close 1 | |
798 return | |
999 :> tomaes'2o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VIC20 version