From: Svjatoslav Agejenko Date: Wed, 11 Sep 2024 14:56:56 +0000 (+0300) Subject: Using AI to improve code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=529d7c742279be68e34a19f07d37d2a99f94221f;p=qbasicapps.git Using AI to improve code readability --- diff --git a/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO3.BAS b/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO3.BAS index 0e69f0f..8b65c88 100755 --- a/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO3.BAS +++ b/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO3.BAS @@ -1,62 +1,85 @@ SCREEN 7, , , 1 +' Main loop label 1 -LINE (0, 0)-(319, 199), RND, BF -SOUND 0, 1 -frm = frm + 1 -st = (SIN(frm / 10) + 2) / 3 -x = SIN(frm / 30) * 50 -y = COS(frm / 42) * 30 - - -FOR a = .1 TO 10 STEP st - CIRCLE (160 + x, 100 + y), 80, 10, , , a -NEXT a - -c = RND * 2 + 12 -FOR a = 0 TO 50 - f = (a + frm) / 12 - f2 = (a + frm) / 7 - x1 = SIN(f) * 50 - y1 = COS(f) * 30 - x2 = SIN(f2 + 6) * 80 - y2 = COS(f2 + 6) * 120 - LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), c -NEXT a - -FOR a = 0 TO 50 - f = (a * 15 + frm) / 12 - f2 = (a * 15 + frm) / 7 - x1 = SIN(f) * 50 - y1 = COS(f) * 30 - x2 = SIN(f2 + 6) * 80 - y2 = COS(f2 + 6) * 120 - CIRCLE (x1 + 80, y1 + 50), a / 2, 14 - PAINT (x1 + 80, y1 + 50), 14 -NEXT a - - -FOR a = 0 TO 15 - f = (a + frm) / 12 - f2 = (a + frm) / 7 - x1 = SIN(f) * 50 - y1 = COS(f) * 30 - x2 = SIN(f2 + 6) * 80 - y2 = COS(f2 + 6) * 120 - LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), c -NEXT a - -FOR a = 0 TO 50 - x = RND * 320 - y = RND * 320 - PSET (x, y), RND * 15 -NEXT a - -PCOPY 0, 1 -CLS - -IF frm > 100 THEN GOTO 2 -GOTO 1 -2 -CHAIN "KHKDEMO4.BAS" + ' Clear the screen + LINE (0, 0)-(319, 199), 0, BF + + ' Delay, to limit animation speed + SOUND 0, 1 + + ' Increment frame counter + frm = frm + 1 + + ' Calculate step size based on sine wave + stpSize = (SIN(frm / 10) + 2) / 3 + + ' Calculate x and y offsets based on sine and cosine waves + xOffset = SIN(frm / 30) * 50 + yOffset = COS(frm / 42) * 30 + + ' Draw circles with varying arc sizes + FOR a = .1 TO 10 STEP stpSize + CIRCLE (160 + xOffset, 100 + yOffset), 80, 10, , , a + NEXT a + + ' Calculate random color + colr = RND * 2 + 12 + + ' Draw lines between points calculated using sine and cosine waves + FOR a = 0 TO 50 + f1 = (a + frm) / 12 + f2 = (a + frm) / 7 + x1 = SIN(f1) * 50 + y1 = COS(f1) * 30 + x2 = SIN(f2 + 6) * 80 + y2 = COS(f2 + 6) * 120 + LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), colr + NEXT a + ' Draw and fill circles with varying radii + FOR a = 0 TO 50 + f1 = (a * 15 + frm) / 12 + f2 = (a * 15 + frm) / 7 + x1 = SIN(f1) * 50 + y1 = COS(f1) * 30 + x2 = SIN(f2 + 6) * 80 + y2 = COS(f2 + 6) * 120 + CIRCLE (x1 + 80, y1 + 50), a / 2, 14 + PAINT (x1 + 80, y1 + 50), 14 + NEXT a + + ' Draw additional lines between points calculated using sine and cosine waves + FOR a = 0 TO 15 + f1 = (a + frm) / 12 + f2 = (a + frm) / 7 + x1 = SIN(f1) * 50 + y1 = COS(f1) * 30 + x2 = SIN(f2 + 6) * 80 + y2 = COS(f2 + 6) * 120 + LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), colr + NEXT a + + ' Draw random points on the screen + FOR a = 0 TO 50 + x = RND * 320 + y = RND * 320 + PSET (x, y), RND * 15 + NEXT a + + ' Copy active page to visual page for smooth animation + PCOPY 0, 1 + + ' Clear the screen + CLS + + ' Check if frame counter exceeds 100 + IF frm > 100 THEN GOTO 2 + + ' Continue loop + GOTO 1 + +' Exit label +2 + ' Chain to another program + CHAIN "KHKDEMO4.BAS"