From c27756cb68682346516848aeddd4570be2fd25db Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Wed, 11 Sep 2024 18:00:45 +0300 Subject: [PATCH] Using AI to improve code readability --- .../KHK Intellektika 2004 demo/KHKDEMO2.BAS | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO2.BAS b/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO2.BAS index 4ce482e..2d0d9da 100755 --- a/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO2.BAS +++ b/Graphics/Presentations/KHK Intellektika 2004 demo/KHKDEMO2.BAS @@ -1,46 +1,51 @@ SCREEN 7, , , 1 1 -FOR a = 1 TO SIN(frm / 30) * 3 + 4 - LOCATE a * 2, a * 4 - COLOR RND * 5 + 10 - PRINT "Programmeerimine ***" +FOR a = 1 TO SIN(frame / 30) * 3 + 4 + LOCATE a * 2, a * 4 + COLOR RND * 5 + 10 + PRINT "Programming is fun!" NEXT a -frm = frm + 1 -st = (SIN(frm / 10) + 2) / 3 -x = SIN(frm / 30) * 50 -y = COS(frm / 42) * 30 +' Update frame and calculate new values for x, y and step size. +frame = frame + 1 +stepSize = (SIN(frame / 10) + 2) / 3 +xPos = SIN(frame / 30) * 50 +yPos = COS(frame / 42) * 30 - -FOR a = .1 TO 10 STEP st - CIRCLE (160 + x, 100 + y), 80, 2, , , a +' Draw circles with varying arc sizes. +FOR a = .1 TO 10 STEP stepSize + CIRCLE (160 + xPos, 100 + yPos), 80, 2, , , a NEXT a -c = RND * 2 + 12 +' Generate random color value for lines. +randomColor = RND * 2 + 12 FOR a = 0 TO 10 - f = (a + frm) / 12 - f2 = (a + frm) / 7 - x1 = SIN(f) * 50 - y1 = COS(f) * 30 - x2 = SIN(f2 + 6) * 50 - y2 = COS(f2 + 6) * 30 - LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), c + f1 = (a + frame) / 12 + f2 = (a + frame) / 7 + x1 = SIN(f1) * 50 + y1 = COS(f1) * 30 + x2 = SIN(f2 + 6) * 50 + y2 = COS(f2 + 6) * 30 + ' Draw line between calculated points. + LINE (x1 + 180, y1 + 150)-(x2 + 180, y2 + 150), randomColor NEXT a +' Draw random pixels on the screen. Like colorful stars in the night sky. FOR a = 0 TO 50 - x = RND * 320 - y = RND * 320 - PSET (x, y), RND * 15 + xRand = RND * 320 + yRand = RND * 320 + PSET (xRand, yRand), RND * 15 NEXT a - - +' Copy the current screen to the next page and clear the current screen. PCOPY 0, 1 CLS -IF frm > 200 THEN GOTO 2 +' Check if frame count has exceeded the limit; if so, chain to another program. +IF frame > 200 THEN GOTO 2 GOTO 1 + 2 CHAIN "KHKDEMO3.BAS" -- 2.20.1