From: Svjatoslav Agejenko Date: Thu, 17 Oct 2024 21:53:46 +0000 (+0300) Subject: Using AI to improve code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=8309269b21104b44f699cdfe44471add8d2a5976;p=qbasicapps.git Using AI to improve code readability --- diff --git a/Automation/School clock/kell/ekr.bas b/Automation/School clock/kell/ekr.bas index e5c6dfc..67ac754 100755 --- a/Automation/School clock/kell/ekr.bas +++ b/Automation/School clock/kell/ekr.bas @@ -1,66 +1,69 @@ DECLARE SUB jooks () DECLARE SUB suva () +DECLARE SUB display () +DECLARE SUB clearBits () DEFINT A-Z -DECLARE SUB cle () -DECLARE SUB disp () DIM SHARED bit(0 TO 16) suva jooks -cle +clearBits bit(10) = 0 bit(14) = 0 bit(6) = 0 bit(2) = 0 4 -disp GOTO 4 -SUB cle +SUB clearBits +' This subroutine initializes all bits in the bit array to 1 FOR a = 1 TO 16 -bit(a) = 1 + bit(a) = 1 NEXT a + END SUB -SUB disp +SUB display +' This subroutine displays the current state of the bit array using LPT attached display prt = &H378 d = 0 FOR a = 0 TO 3 -c = 2 ^ a -FOR b = 4 TO 7 -d = d + 1 -c = c + (bit(d) * 2 ^ b) -NEXT b + c = 2 ^ a + FOR b = 4 TO 7 + d = d + 1 + c = c + (bit(d) * 2 ^ b) + NEXT b -OUT prt, c + OUT prt, c NEXT a END SUB SUB jooks +' This subroutine demonstrates a simple counting 2 -cle +clearBits FOR a = 1 TO 16 -bit(16) = 1 -bit(a - 1) = 1 -bit(a) = 0 -PRINT a -FOR b = 1 TO 1000 -disp -NEXT b + bit(16) = 1 ' Set the most significant bit to 1 + bit(a - 1) = 1 ' Set the previous bit to 1 + bit(a) = 0 ' Clear the current bit + PRINT a + FOR b = 1 TO 1000 + display + NEXT b NEXT a GOTO 2 - END SUB SUB suva +' This subroutine demonstrates a simple random bit setting algorithm 3 -cle +clearBits FOR b = 1 TO 16 -IF RND * 100 > 50 THEN bit(b) = 0 + IF RND * 100 > 50 THEN bit(b) = 0 ' Randomly set bits to 0 NEXT b FOR b = 1 TO 100 -disp + display NEXT b GOTO 3 END SUB diff --git a/Database/ddbase6.bas b/Database/ddbase6.bas index 763497b..7a1d8f5 100755 --- a/Database/ddbase6.bas +++ b/Database/ddbase6.bas @@ -1,6 +1,11 @@ -' Dos Database -' made by Svjatoslav Agejenko -' in 2002 +' Simple scriptable relational database engine. +' By Svjatoslav Agejenko. +' Email: svjatoslav@svjatoslav.eu +' Homepage: http://www.svjatoslav.eu +' +' Changelog: +' 2002, Initial version +' 2024, Improved program readability using AI DECLARE SUB box (x1%, y1%, x2%, y2%) DECLARE SUB ssort (s%, m%) @@ -966,4 +971,3 @@ conm " ", 10 conm "================> " + a$ + " <===============", 7 END SUB - diff --git a/Games/Checkers 2/checkers2.bas b/Games/Checkers 2/checkers2.bas index b20bddf..4326187 100755 --- a/Games/Checkers 2/checkers2.bas +++ b/Games/Checkers 2/checkers2.bas @@ -1,5 +1,11 @@ -' Checkers game (unfinished) -' by Svjatoslav Agejenko 2001 +' Game of checkers. Supports basic moves. Incomplete. +' By Svjatoslav Agejenko. +' Email: svjatoslav@svjatoslav.eu +' Homepage: http://www.svjatoslav.eu +' +' Changelog: +' 2001, Initial version +' 2024, Improved program readability using AI DECLARE SUB compki (m%, h%, x1%, y1%) DECLARE SUB compgo2 (h%)