Skip to content

Instantly share code, notes, and snippets.

@tomaes
Last active December 4, 2020 10:26
Show Gist options
  • Save tomaes/8868532aab19fcafc75ff427ae753aab to your computer and use it in GitHub Desktop.
Save tomaes/8868532aab19fcafc75ff427ae753aab to your computer and use it in GitHub Desktop.
A population quiz game in moreorless.io style (Commodore Plus/4 version)
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
@tomaes
Copy link
Author

tomaes commented May 25, 2020

country quiz (short, dirty)

0 clr:fori=.to8:readd$,d:c(i)=d:c$(i)=d$:next:r=1:tj=ti
1 print"where do more people live?"chr$(13)"a fast country quiz!"
2 forj=.to1:q(j)=int(rnd(1)*9):next:ifq(.)=q(1)then2
3 printchr$(13)r"[1] "c$(q(.))" vs [2] "c$(q(1))"?";
4 fori=.to499:geta$:ifa$<"1"ora$>"2"thennext:a$="1"
5 a=val(a$):ifc(q(a-1))>c(q(1-(a-1)))thenprint"-ok":r=r+1:goto2
6 print"-??":printc$(q(.))":"str$(c(q(.)))"m / "c$(q(1))":"str$(c(q(1)))"m"
7 t=int((ti-tj)/60):print"t:"t"sec.":ifr>30andt<r*2thenprint"great!"
8 data"bra",212,"ger",83,"ita",60,"bul",7,"can",37,"rok",51
9 data"arg",45,"egy",102,"swe",10:input"again?";a$:ifa$="y"then0

@tomaes
Copy link
Author

tomaes commented May 26, 2020

Commodore 128 version

0 rem  _,/'%%&&&&&&&&&&&&&&&&&%%'\__
1 rem ((_Country Pop + C128 version_))
2 rem  \_\_/%\%%%%%%%%%%%%%%%/%\_/_/
3 :                               :
4 :   v$ = "v1.2f, May/June 2020" :
5 :                               :
9 rem init ***********************;
10 graphic 5: vol 5: n = 20
11 o5 = rclr(5): o6 = rclr(6)  
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 print chr$(14): color 6,7: gosub 600
19 :
20 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 5,8: 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 sleep(1)
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 5,4
67 print str$(r)". ";: if ot = 0 then print "[a] ";
68 color 5,2 :print c$(p);: color 5,4
69 print " vs. ";:     if ot = 0 then print "[b] ";
70 color 5,2: print c$(q);: color 5,8
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 5,11 :print " X Sorry, fault!"
81 sound 1, 200, 20
82 if ot = 1 and a$ <> c$(p) and a$ <> c$(q) then print " Fatal Typing!"
83 color 5,4
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 5,2: print r$: color 5,4
96 if r$<hi$(od) then hi$(od)=r$: print "New best rating in '";di$(od);"'"
97 print: input "Try again (same settings) or restart (y/n)";a$
98 if a$ = "y" then goto 50: else gosub 600: goto 30
99 :
200 rem welcome header ------------------------------------------------------
235 color 5,5: print: print ">> ";
236 color 5,8: print "Country Pop (Commodore 128 version)";
237 color 5,5: print " - a manic geography battle quiz"
260 :
300 rem settings menu -------------------------------------------------------
303 print: color 5,14
305 print "Welcome to the Settings Menu. ";: color 5,4 
306 print "Type the things " chr$(2) "in quotes": print "."
310 print chr$(235)" Input: '";: if ot = 1 then color 5,2 :else color 5,4
315 print "Typing";: color 5,4 : print "' correctly ... vs. slamming '";
316 if ot = 0 then color 5,2 :else color 5,4
317 print "Keys";: color 5,4 : print"'"
318 :
320 print chr$(235)" Modes: '";: if oa = 0 then color 5,2 :else color 5,4
321 print "People";: color 5,4 : print "' ............. vs. '";
322 if oa = 1 then color 5,2 :else color 5,4
323 print "Area";:   color 5,4 : print "'"
324 :
329 print chr$(235)" Style: '";: if oo = 1 then color 5,2 :else color 5,4
330 print "Olympics";: color 5,4: print "' codes ..... vs. '";
331 if oo = 0 then color 5,2 :else color 5,4
332 print "Country";: 
333 color 5,4 : print "' names"
334 print chr$(235)" Skill: '";: if od = 4 then color 5,2 :else color 5,4
337 print "hard";:  color 5,4 : print "','"; 
338 if od = 3 then color 5,2 :else color 5,4
339 print "doable";:color 5,4 : print "' ...... vs. '";
340 if od = 2 then color 5,2 :else color 5,4
341 print "easy";:  color 5,4 : print "','";
342 if od = 1 then color 5,2 :else color 5,4 
343 print "kids";:  color 5,4 : print "'"
344 :
345 a$=chr$(192): color 5,14
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
363 if a$ = "info"    then gosub 700
364 if a$ = "col1"    then color 6,7:  goto 347
365 if a$ = "col2"    then color 6,1:  goto 347
366 if a$ = "col3"    then color 6,13: goto 347
367 if a$ = "play"    then return
368 if a$ = "cheat"   then print "No IDKFA in this one!": goto 347
369 if a$ = "tutorial"then gosub 666
370 if a$ = "ver"  then print: print v$: goto 347
371 if a$ = "list" then gosub 380
372 if a$ = "help" then print "hint: CapiTaliZe correctly!": goto 347
373 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 sound 1, 200, 20: goto 347
378 goto 300
379 :
380 rem country listing -------------------------------------
382 color 5,2: print
383 print "Country" tab(13) "IOC" tab(21) "Pop." tab(30) "Area", 
384 print "Country" tab(54) "IOC" tab(62) "Pop." tab(71) "Area"
385 color 5,5
386 for i= 0 to n-1 step 2
388  print "> "ac$(i) tab(12) "(" ao$(i) ")";
389  : print using "   ###.#"; ap(i); : print using "     #.####"; aa(i);
390  print "    > "ac$(i+1) tab(53) "(" ao$(i+1) ")";
391  : print using "   ###.#"; ap(i+1);: print using "     #.###"; aa(i+1)
392 next
394 return
396 :
399 rem quit ------------------------------------------------
400 color 5,o5: color 6,o6
402 print chr$(142)"bye!"
403 end
404 : 
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 5, 3: print"  /))  ../)))   ;  ;   /)  /   ((()   /o))   (..(    /))))   .())))   /))))"
602 color 5,10: print" //     /o))   /  /   /-) /    //    ;))     (/)    /))))    ;(0))   /)))) "
603 color 5, 8: print"'*)))  /)))   (((/   /--)/    //    /  ))    /     //       (((()   //     "
610 color 5,3
612 for i=0 to  4: print "=";: next: color 5,9
614 for i=0 to  9: print "=";: next: color 5,11
616 for i=0 to 54: print "=";: 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 5,2
670 print "Type out the alphabet as fast as possible!"
672 color 5,8: print "> ";: i = 0
680 get a$: if a$="" then 680
682 print a$;: if asc(a$)=65+i then i=i+1: if i < 26 then 680
684 if i = 26 then print " < ": color 5,4: print chr$(186)" Done!": return
686 print " ...better luck next time! ("i"correct )" : return
690 :
700 rem info -----------------------------------------------------------------
702 print: color 5,2: print chr$(2)"Country Pop 128, the story"
703 print: color 5,4
705 print "After playing moreorless.io and looking at the Worldometers tables"
708 print "once too often, a micro game in Commodore BASIC v2 emerged and from"
709 print "that a mini game that was ported over to Plus/4, and further on"
710 print "to the C128 machine and then back again!"
711 print
712 print: color 5,2: print "...some additional keywords to try"
713 print: color 5,4
714 print "'colx' (x=1..3)", "change background color"
715 print "'ver'",,          "show version number"
716 print "'tutorial'",      "mini game / typing exercise"
717 print "'list'",,         "list country data"
718 print "'best'",,         "list best score ratings"
720 print "'load','save'",   "load/save score ratings"
722 print "'x' or 'q'", "quick exit": print
723 color 5,2: print "press key"
724 a$="": do: get a$: loop until a$<>""
725 return
730 :
750 rem hiscore ----------------------------------------------
752 color 5,2: print: print "skill","best rating"
753 color 5,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

@tomaes
Copy link
Author

tomaes commented May 28, 2020

Mini geo pop quiz (CBM Plus/4)

0 d$="de8it6no1au2ru9pl3":a=int(rnd(1)*6):b=abs(5-a):k$=mid$(d$,a*3+1,2):r=r+1
1 u$=mid$(d$,a*3+3,1):l$=mid$(d$,b*3+1,2):v$=mid$(d$,b*3+3,1):printr;k$">"l$"?"
2 fori=.to199:geta$:ifa$=""thennext:elseifa$="y"andu$>v$or(a$="n"andu$<v$)then0
3 print" ..?":input"again";a$:ifa$="y"thenrun

@tomaes
Copy link
Author

tomaes commented Jun 10, 2020

Commodore 64 version

0 rem  _,/'%%&&&&&&&&&&&&&&&&&%%'\__
1 rem ((_country pop - c64 version_))
2 rem  \_\%%%%%%%%%%%%%%%%%%%%%%%/_/
4 :  v$ = "v1.3a, May/June 2020" :
6 rem init oooooooooooooooooooooo;
7  :
8  n  = 20
9  cl = 646
10 sc = 53280
11 si = 54272
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 poke sc,6: poke sc+1,6: print chr$(14)
19 gosub 850: gosub 590: gosub 600
20 :
21 rem hiscore init, read all 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 poke cl,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 fx = 1: gosub 800
66 poke cl,3: print
67 print str$(r)".";: if ot = 0 then print "[a] ";
68 poke cl,1 :print c$(p);: poke cl,3
69 print " vs ";:     if ot = 0 then print "[b] ";
70 poke cl,1: print c$(q);: poke cl,7: ok = 0
71 if ot = 1 then print: input ">";a$
72 if ot = 0 then for i = 0 to 999: get a$: if a$<>"a"anda$<>"b" then next
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 poke cl,10:  print " X Fault!"
81 fx = 2: gosub 800
82 :
83 print: poke cl,3: m$ = "M": if oa = 1 then m$ = "T sq km"
84 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": fx = 3: gosub 800: fx = 3-(r>5)
90 if r >  5 and t < r*8 then gosub 800: r$ = "C (zZz)"
91 if r > 10 and t < r*4 then gosub 800: r$ = "B (Alright)"
92 if r > 20 and t < r*3 then gosub 800: r$ = "A (Well done!)"
93 if r > 30 and t < r*2 then gosub 800: r$ = "* (Impressive!)"
94 if r > 99 and t < r*3 then gosub 800: r$ = "! (Amazing!)"
95 print "Rating: ";: poke cl,1: print r$: poke cl,3
96 if r$ < hi$(od) then hi$(od) = r$: print "New best rating in '";di$(od);"'"
97 print: input "Again (same config) or restart (y/n)"; a$
98 if a$ = "y" then 50
99 gosub 600:  goto 30
100 :
200 rem welcome header ***************
235 poke cl, 4: print "  >> ";
236 poke cl, 7: print "Country Pop (Commodore 64 version)"
237 poke cl,10: print "  ...a frantic geography battle quiz <<"
260 :
300 rem settings menu ****************
303 print: poke cl,13
305 print "Settings >";: poke cl,3 
306 print "Type the words in quotes.": print "."
310 print chr$(235)" Input: '";
311 if ot = 1 then poke cl,1 
312 if ot = 0 then poke cl,3
313 print "Typing";: poke cl,3: print "' vs. slamming '";
314 if ot = 0 then poke cl,1 
315 if ot = 1 then poke cl,3
316 print "Keys";:   poke cl,3: print"'"
318 :
320 print chr$(235)" Modes: '"; 
321 if oa = 0 then poke cl,1
322 if oa = 1 then poke cl,3
323 print "People";: poke cl,3 : print "' vs. '";
324 if oa = 1 then poke cl,1
325 if oa = 0 then poke cl,3
326 print "Area";:   poke cl,3 : print "'"
327 :
328 print chr$(235)" Style: '";: if oo = 1 then poke cl,1 
329 if oo = 0 then poke cl,3
330 print "Olympics";: poke cl,3: print "' vs. '";
341 if oo = 0 then poke cl,1 
342 if oo = 1 then poke cl,3
342 print "Country";: 
343 poke cl,3: print "' names"
344 print chr$(235)" Skill: '";: if od = 4 then poke cl,1
345 if od <>4 then poke cl,3
346 print di$(4);: poke cl,3: print "','";: if od = 3 then poke cl,1 
347 if od <>3 then poke cl,3
348 print di$(3);: poke cl,3: print "','";: if od = 2 then poke cl,1
349 if od <>2 then poke cl,3
351 print di$(2);: poke cl,3: print "','";: if od = 1 then poke cl,1
352 if od <>1 then poke cl,3 
353 print di$(1);: poke cl,3: print "'"
354 :
355 a$ = chr$(192): poke cl,13
356 print chr$(237) a$a$a$a$a$a$ "> 'play' vs. 'exit' or 'info'"
357 a$ = "": print: input ">";a$
358 :
360 if a$ = "Olympics"then oo = 1
361 if a$ = "Country" then oo = 0
362 if a$ = "Typing"  then ot = 1
363 if a$ = "Keys"    then ot = 0
364 if a$ = "People"  then oa = 0
365 if a$ = "Area"    then oa = 1
366 if a$ = di$(5)    then od = 5
367 if a$ = di$(4)    then od = 4
368 if a$ = di$(3)    then od = 3
369 if a$ = di$(2)    then od = 2
370 if a$ = di$(1)    then od = 1
371 if a$ = di$(0)    then od = 0
372 if a$ = "play" or a$="run" then return
373 if a$ = "sounds"  then gosub 900
374 if a$ = "tutorial"then gosub 666
375 if a$ = "ver"  then print: print v$: goto 357
376 if a$ = "list" then gosub 400
377 if a$ = "col1" then poke sc,6 :poke sc+1,6: goto 357
378 if a$ = "col2" then poke sc,9 :poke sc+1,9: goto 357
379 if a$ = "col3" then poke sc,11:poke sc+1,11:goto 357
380 if a$ = "info"  then gosub 700
382 if a$ = "exit" or a$="x" or a$="q" then 500
384 if a$ = "help" then print "hint: CaPitaLiZe!": goto 357
385 if a$ = "best" then gosub 750
386 if a$ = "load" then gosub 770
387 if a$ = "save" then gosub 780
388 if a$ = ""     then 357
389 goto 300
390 :
400 rem country listing **************
418 poke cl,1: print
420 print "Country" tab(13) "IOC" tab(21) "Pop." tab(30) "Area"
422 poke cl,5
424 for i = 0 to n-1
426  ap$ = mid$(str$(ap(i)), 2, len(str$(ap(i)))-1): p1 = 0
428  p1 = p1+1: if mid$(ap$,p1,1) <> "." then 428
430  if p1 = 1 then ap$="   0"+ap$
432  if p1 = 2 then ap$="   "+ap$
434  if p1 = 3 then ap$="  "+ap$
436  if p1 = 4 then ap$=" "+ap$
438  aa$ = str$(aa(i))
439  p2  = len(aa$)
440  for ii = len(aa$) to 5
441  :  aa$ = " " + aa$: next 
442  print "> "ac$(i) tab(12) "(" ao$(i) ") ";
444  print tab(20) ap$  tab(28) aa$
445 next
446 poke cl, 1: print "press key"
447 poke 198,.: wait 198,1
448 return
450 :
499 rem quit ********************
500 poke cl, 14: rem text  (org)
501 poke sc, 14: rem main  (org)
502 poke sc+1,6: rem frame (org) 
503 for i = 0 to 25: print: next
504 print chr$(142) "bye!"
505 end
510 : 
520 rem boot logo data *************************************************
526 data 1,28, 2,32, 4,164, 1,32, 4,164, 1,32, 1,164, 2,32, 1,164, 1,32, 4,164
528 data 1,32, 5,164, 1,32, 3,164, 2,32, 1,164, 3,32, 1,164, 1,13
530 data 1,32, 1,47, 3,32, 2,47, 3,32, 3,47, 1,32, 3,47, 3,32, 2,47
532 data 4,164, 5,47, 1,165, 2,47, 2,32, 2,47, 1,165, 1,13
534 data 1,28, 1,32, 4,169, 1,47, 4,127, 1,32, 1,127, 2,32, 1,127, 1,32, 4,127
536 data 1,32, 5,127, 1,47, 1,127, 1,183, 1,127, 1,32, 1,165, 1,127, 1,47
538 data 2,32, 1,127, 1,32, 1,165, 1,13
540 data 1,150, 1,32, 1,127, 3,32, 1,47, 1,127, 2,32, 1,127, 1,32, 1,127, 1,47
542 data 1,32, 1,127, 1,32, 1,127, 1,170, 1,32, 1,127, 3,32, 1,127, 1,170
544 data 2,32, 3,127, 2,47, 5,127, 1,47, 1,13
546 data 1,158, 1,32, 4,169, 1,47, 4,169, 1,47, 4,169, 1,47, 1,169, 1,47, 1,32
548 data 1,169, 1,47, 2,32, 1,169, 1,47, 2,32, 1,169, 1,47, 1,32, 1,169
550 data 1,47, 2,32, 1,169, 1,47, 0,0
557 : 
558 rem 2020 stats ********************
559 rem - country --- ioc -- pop - area
560 data "Brazil",   "BRA", 212.6, 8520
561 data "Germany",  "GER",  83.8,  360
562 data "Italy",    "ITA",  60.5,  300
563 data "Cuba",     "CUB",  11.3,  110
564 data "Canada",   "CAN",  37.7, 9980
565 data "S. Korea", "KOR",  51.3,  100
566 data "Argentina","ARG",  45.2, 2780
567 data "Egypt",    "EGY", 102.3, 1002
568 data "Sweden",   "SWE",  10.1,  450
569 data "Oman",     "OMA",   5.1,  310
570 data "Jordan",   "JOR",  10.2,   90
571 data "Fiji",     "FIJ",   0.9,   18
572 data "Mongolia", "MGL",   3.3, 1560
573 data "Botswana", "BOT",   2.4,  580
574 rem --------------------------------
575 data "Burundi",   "BDI", 11.9,   29
576 data "Uzbekistan","UZB", 33.5,  450
577 data "Nepal",     "NEP", 29.1,  150
578 data "Panama",    "PAN",  4.3,   80
579 data "Malta",     "MLT", 0.44,    3
580 data "Sri Lanka", "SRI", 21.4,   66
581 :
584 rem read boot logo **********************************************
590 reada,b:ifa<>.thenfori=1toa:lg$=lg$+chr$(b):next:goto590
595 return
598 :
599 rem print boot logo *********************************************
600 print lg$
610 poke cl, 2
612 for i = 0 to  4 step 2: print chr$(192)"-";: next: poke cl,8
614 for i = 0 to  9 step 2: print chr$(192)"-";: next: poke cl,10
616 for i = 0 to 23 step 2: print chr$(192)"-";: next
618 fx = 5: gosub 800
624 return
626 :
666 rem "tutorial" *********************************************
668 print: poke cl, 1
670 print "Type the alphabet as fast as possible!"
672 poke cl,7: print "> ";: i = 0: a$ = ""
680 get a$: if a$ = "" then 680
682 print a$;: if asc(a$) = 65+i then i = i+1: if i < 26 then 680
684 if i = 26 then print " < ": poke cl,3: print chr$(186)" Done!": return
686 print: print " ...not quite! ("i" / 26 )": a$ = "": return
690 :
700 rem info ******************************************
702 print: poke cl,1: print "Country Pop 64, the story"
703 print: poke cl,3
704 print
705 print "After playing moreorless.io and"
706 print "looking at the Worldometers tables"
707 print "once too often, a micro game in BASIC"
708 print "emerged and from that a mini game for"
709 print "C64, that was ported to Plus/4, and"
710 print "further to the C128 ...and back again!"
711 print
712 print: poke cl,1: print "...some additional keywords to try"
713 print: poke cl,3
714 print "'colx' (x=1..3)","change background"
716 print "'ver'",,         "show version"
717 print "'sounds'",,      "sound test"
718 print "'tutorial'",     "typing experience"
720 print "'list'",,        "country data"
721 print "'best'",,        "hi-score list"
722 print "'load','save'",  "hi-score load/save"
723 print "'x' or 'q'",     "quick exit"
724 print: poke cl,1: print "press key"
725 poke 198,.: wait 198,1
727 return
730 :
750 rem hiscore **********************
751 poke cl,1
752 print: print "skill","best rating"
753 poke cl,3
754 for i = 0 to 5: print di$(i), hi$(i): next
756 return
757 :
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
799 :
800 rem sound fx **********
801 s1(1) = 25 + (r and 63)
802 s1(4) = 60 + (r and 63)*2
804 poke si +24, 15
810 poke si + 0, s0(fx): poke si + 1, s1(fx)
812 poke si + 5, s5(fx): poke si + 4, s4(fx) 
814 for i = 0 to fl(fx): next: poke si + 4, 0
820 return
840 :
850 rem init sounds **********************************************
852 s0(1)=3  :s1(1)=.   :s5(1)=20  :s4(1)=33  :fl(1)=15: rem round
853 s0(2)=3  :s1(2)=80  :s5(2)=21  :s4(2)=129 :fl(2)=40: rem fault
854 s0(3)=3  :s1(3)=64  :s5(3)=127 :s4(3)=17  :fl(3)=20: rem g.over
855 s0(4)=3  :s1(4)=.   :s5(4)=218 :s4(4)=17  :fl(4)=30: rem rating
857 s0(5)=3  :s1(5)=40  :s5(5)=15  :s4(5)=17  :fl(5)=99: rem start
860 return
870 :
900 rem soundtest *************************************************
901 fx = 1
902 for ii = 1 to 20:  r = ii: gosub 800: print str$(ii)")";: next: print
903 for ii = 2 to  5: fx = ii: gosub 800: print ii;: next: print
905 return
999 :> tomaes'2o

@tomaes
Copy link
Author

tomaes commented Jun 16, 2020

VIC20 version

11 n=14:cl=646:sc=36879:s=sc-5:w=999
14 dimc$(n),c(n):dimac$(n),ao$(n),ap(n),aa%(n)
16 di(2)=8:di(3)=10:di(4)=14:od=3:pokesc,8
20 printchr$(14):fori=.ton-1:readd1$,d2$,d3,d4
26 ac$(i)=d1$:ap(i)=d3:ao$(i)=d2$:aa%(i)=d4:next   
29 :
30 gosub200:fori=.ton-1:c$(i)=ac$(i):c(i)=ap(i)
38 ifoo=1thenc$(i)=ao$(i)
39 ifoa=1thenc(i)=aa%(i)
40 next
50 :
51 pokecl,7:print:ifoa=0thenprint"Where do > folks live?"
53 ifoa=1thenprint"What terr. is bigger?":print"Get ready!"
54 fori=0tow*2:next:tj=ti:r=0
55 :
60 r=r+1:p=int(rnd(1)*di(od)):fx=200+(rand31):gosub800
62 q=int(rnd(1)*di(od)):ifp=qthen62
66 print:pokecl,3:printstr$(r)"."tab(4);:ifot=0thenprint"[a] ";
68 pokecl,1:printc$(p);:pokecl,3:print" vs.":printtab(4):ok=0
69 ifot=0thenprint"[b] ";:pokecl,1:printc$(q);:pokecl,7
71 ifot=1thenpokecl,1:print"   "c$(q):pokecl,3:input">";a$
72 ifot=0thenfori=.tow:geta$:ifa$<>"a"anda$<>"b"thennext
73 ifot=1anda$=c$(p)thena$="a":ok=1
74 ifot=1anda$=c$(q)thena$="b":ok=1
75 ifot=1andok=0thenpokecl,5:print" Fatal Typing!":goto80 
76 ifa$="a"andc(p)>c(q)thenprint" "chr$(186)" Ok":goto60
77 ifa$="b"andc(q)>c(p)thenprint" "chr$(186)" Jo":goto60
79 :
80 pokecl,2:print:print" Fault!":pokecl,3:print:fx=240:gosub800
82 m$="M":ifoa=1thenm$="T sq km"
84 printc$(p)":"str$(c(p))m$
85 printc$(q)":"str$(c(q))m$
86 print:t=(ti-tj)/60:print"Time all:"t
88 print"Time/#  :"t/r:r$="D" 
92 if r>5andt<r*8thenfx=200:r$="C=>zZz"
93 ifr>10andt<r*4thenfx=220:r$="B=>Alright"
94 ifr>20andt<r*3thenfx=240:r$="A=>Well done!"
95 ifr>30andt<r*2thenfx=255:r$="*=>Impressive!"
96 print"Rating  : ";:pokecl,1:printr$:pokecl,3:print:gosub800
97 input"Again or new (y/n)";a$:ifa$="y"then50
99 goto30
200 :
220 print:pokecl,2:print"%%%%%%%%%%%%%%%%%%%%"
236 pokecl,7:print"Country Pop (VIC-20)"
237 pokecl,1:print"a quirky geo quiz"
239 pokecl,2:print"%%%%%%%%%%%%%%%%%%%%":fx=200:gosub800
300 :
303 pokecl,3:print:print"Type what's (enclosed)"
310 ifot=1thenpokecl,1 
312 print"(";:ifot=0thenpokecl,3
313 print"Typing";:pokecl,3:print")  -  (";
314 ifot=0thenpokecl,1 
315 ifot=1thenpokecl,3
316 print"Keys";:pokecl,3:print")"
320 print"(";
321 ifoa=0thenpokecl,1
322 ifoa=1thenpokecl,3
323 print"People";:pokecl,3:print")  -  (";
324 ifoa=1thenpokecl,1
325 ifoa=0thenpokecl,3
326 print"Area";:pokecl,3:print")"
328 print"(";:ifoo=1thenpokecl,1 
329 ifoo=0thenpokecl,3
330 print"Olympia";:pokecl,3:print") -  (";
341 ifoo=0thenpokecl,1 
342 ifoo=1thenpokecl,3
342 print"Country"; 
343 pokecl,3:print")":print
344 print"(";:ifod=4thenpokecl,1
345 ifod<>4thenpokecl,3
346 print"hard";:pokecl,3:print"),(";:ifod=3thenpokecl,1 
347 ifod<>3thenpokecl,3
348 print"doable";:pokecl,3:print"),(";:ifod=2thenpokecl,1
349 ifod<>2thenpokecl,3
351 print"easy";:pokecl,3:print")";:pokecl,4:print"(play),(exit)"
354 pokecl,3:a$="":print:input">";a$
360 ifa$="Olympia"thenoo=1
361 ifa$="Country"thenoo=0
362 ifa$="Typing"thenot=1
363 ifa$="Keys"thenot=0
364 ifa$="People"thenoa=0
365 ifa$="Area"thenoa=1
367 ifa$="hard"thenod=4
368 ifa$="doable"thenod=3
369 ifa$="easy"thenod=2
372 ifa$="play"thenreturn
374 ifa$="help"thenprint"Hint: CapiTaliZe!"
375 ifa$="ver"thenprint"Crnchd VC20 v.; Jne'20"
382 ifa$="exit"ora$="x"then500
386 ifa$=""then357
389 goto300
500 pokecl,6:pokesc,27:fori=.to25:print:next:printchr$(142)"bye!":end
508 :
510 data"Brazil","BRA",212.4,8520,"Germany","GER",83.8,360
512 data"Italy","ITA",60.5,300,"Cuba","CUB",11.3,110
514 data"Canada","CAN",37.7,9980,"S. Korea","KOR",51.3,100
516 data"Argentina","ARG",45.2,2780,"Egypt","EGY",102.1,1002
518 data"Sweden","SWE",10.1,450,"Oman","OMA",5.1,310
520 data"Jordan","JOR",10.2,90,"Fiji","FIJ",0.9,18
522 data"Mongolia","MGL",3.3,1560,"Botswana","BOT",2.3,580
530 :
800 pokes+4,15:pokes+1,fx:fori=1to59:next:pokes+1,.:return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment