DECLARE SUB jooks ()\r
DECLARE SUB suva ()\r
+DECLARE SUB display ()\r
+DECLARE SUB clearBits ()\r
DEFINT A-Z\r
-DECLARE SUB cle ()\r
-DECLARE SUB disp ()\r
DIM SHARED bit(0 TO 16)\r
\r
suva\r
jooks\r
\r
-cle\r
+clearBits\r
bit(10) = 0\r
bit(14) = 0\r
bit(6) = 0\r
bit(2) = 0\r
4\r
-disp\r
GOTO 4\r
\r
-SUB cle\r
+SUB clearBits\r
+' This subroutine initializes all bits in the bit array to 1\r
FOR a = 1 TO 16\r
-bit(a) = 1\r
+ bit(a) = 1\r
NEXT a\r
+\r
END SUB\r
\r
-SUB disp\r
+SUB display\r
+' This subroutine displays the current state of the bit array using LPT attached display\r
prt = &H378\r
d = 0\r
FOR a = 0 TO 3\r
-c = 2 ^ a\r
-FOR b = 4 TO 7\r
-d = d + 1\r
-c = c + (bit(d) * 2 ^ b)\r
-NEXT b\r
+ c = 2 ^ a\r
+ FOR b = 4 TO 7\r
+ d = d + 1\r
+ c = c + (bit(d) * 2 ^ b)\r
+ NEXT b\r
\r
-OUT prt, c\r
+ OUT prt, c\r
NEXT a\r
END SUB\r
\r
SUB jooks\r
+' This subroutine demonstrates a simple counting\r
2\r
-cle\r
+clearBits\r
FOR a = 1 TO 16\r
-bit(16) = 1\r
-bit(a - 1) = 1\r
-bit(a) = 0\r
-PRINT a\r
-FOR b = 1 TO 1000\r
-disp\r
-NEXT b\r
+ bit(16) = 1 ' Set the most significant bit to 1\r
+ bit(a - 1) = 1 ' Set the previous bit to 1\r
+ bit(a) = 0 ' Clear the current bit\r
+ PRINT a\r
+ FOR b = 1 TO 1000\r
+ display\r
+ NEXT b\r
NEXT a\r
GOTO 2\r
-\r
END SUB\r
\r
SUB suva\r
+' This subroutine demonstrates a simple random bit setting algorithm\r
3\r
-cle\r
+clearBits\r
FOR b = 1 TO 16\r
-IF RND * 100 > 50 THEN bit(b) = 0\r
+ IF RND * 100 > 50 THEN bit(b) = 0 ' Randomly set bits to 0\r
NEXT b\r
FOR b = 1 TO 100\r
-disp\r
+ display\r
NEXT b\r
GOTO 3\r
END SUB\r
-' Dos Database\r
-' made by Svjatoslav Agejenko\r
-' in 2002\r
+' Simple scriptable relational database engine.\r
+' By Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' 2002, Initial version\r
+' 2024, Improved program readability using AI\r
\r
DECLARE SUB box (x1%, y1%, x2%, y2%)\r
DECLARE SUB ssort (s%, m%)\r
conm "================> " + a$ + " <===============", 7\r
\r
END SUB\r
-\r
-' 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%)