Better code readability.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 29 Jun 2025 11:48:02 +0000 (14:48 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 29 Jun 2025 11:48:02 +0000 (14:48 +0300)
Games/Worm/worm.bas

index 68df0b8..bf6227d 100755 (executable)
@@ -1,10 +1,3 @@
-DECLARE SUB delay (seconds AS SINGLE)\r
-DECLARE SUB drawGridCell (x%, y%)\r
-DECLARE SUB clearTail (playerNumber%)\r
-DECLARE SUB start ()\r
-DECLARE SUB stuff ()\r
-DECLARE SUB stat ()\r
-\r
 ' Game of worms.\r
 '\r
 ' Game supports up to 5 players. Any amount of those players can be AI controlled.\r
@@ -24,7 +17,7 @@ DECLARE SUB stat ()
 \r
 ' Changelog:\r
 ' 2002, Initial version\r
-' 2024, Improved program readability using AI\r
+' 2024-2005, Improved program readability\r
 \r
 DECLARE FUNCTION cnum$ (a%)\r
 DECLARE SUB putworm (a%)\r
@@ -296,13 +289,12 @@ SUB autop (a%)
     END IF\r
 END SUB\r
 \r
-' This subroutine takes care of clearing out worm tail.\r
-' As form head advances forword in each frame, this procedure\r
-' is responsible for clearing out squares where worm tail moved out\r
-' of. Such squares are marked as empty (no longer occupied by worm)\r
-' and also correspondingly are erased from the screen.\r
 SUB clearTail (playerNumber)\r
-\r
+    ' This subroutine takes care of clearing out worm tail.\r
+    ' As worm head advances forward in each frame, this procedure\r
+    ' is responsible for clearing out squares where worm tail moved out\r
+    ' of. Such squares are marked as empty (no longer occupied by worm)\r
+    ' and also correspondingly are erased from the screen.\r
     a = ussp(playerNumber) - ussl(playerNumber)\r
 \r
     IF a < 1 THEN\r
@@ -336,14 +328,12 @@ SUB dead (a%)
     putworm a\r
 END SUB\r
 \r
-' Since QBasic does not have precise timer suitable for delaying animations,\r
-' workaround here is to use SOUND function. Inaudible sound with frequency\r
-' of 0 Hz is produced. Second argument for SOUND function is sound duration\r
-' that is approximately 1/18'th of the second.\r
 SUB delay (delayInSeconds AS SINGLE)\r
-\r
-SOUND 0, delayInSeconds * 18\r
-\r
+    ' Since QBasic does not have precise timer suitable for delaying animations,\r
+    ' workaround here is to use SOUND function. Inaudible sound with frequency\r
+    ' of 0 Hz is produced. Second argument for SOUND function is sound duration\r
+    ' that is approximately 1/18'th of the second.\r
+    SOUND 0, delayInSeconds * 18\r
 END SUB\r
 \r
 SUB drawGridCell (x%, y%)\r
@@ -886,4 +876,3 @@ SUB tkt
         prc a\r
     NEXT a\r
 END SUB\r
-\r