Created
May 4, 2020 07:19
-
-
Save tomaes/72624052db073776843bb4d602f5e173 to your computer and use it in GitHub Desktop.
Audio micro game. Make it through 12 rounds of approximate frequency estimation.
This file contains hidden or 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
program Hz; {sound micro game; 2020-5-4} | |
uses crt; | |
var f,q,p,r: integer; s: string; | |
begin | |
clrscr; | |
writeln('Guess My Frequency (20-2000Hz)'); | |
randomize; | |
r := 0; s := ''; | |
repeat | |
f := random(1980)+20; | |
sound(f); delay(200); nosound; | |
write('Hz? '); | |
readln(q); | |
inc(r); | |
inc(p,200); | |
dec(p,abs(q-f)); | |
if (q-f > 0) then s := '+' else s := ''; | |
writeln('/\/:',f,' a-b:', s, q-f, ' $:', p); | |
until (r = 12) or (p < 0); | |
writeln(r, ' round[s]'); | |
if (p > 400) then writeln('Well done!'); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment