From: Svjatoslav Agejenko Date: Sun, 29 Jun 2025 11:48:02 +0000 (+0300) Subject: Better code readability. X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=42882c25534387472eb1e7dccfc0e927f5aab604;p=qbasicapps.git Better code readability. --- diff --git a/Games/Worm/worm.bas b/Games/Worm/worm.bas index 68df0b8..bf6227d 100755 --- a/Games/Worm/worm.bas +++ b/Games/Worm/worm.bas @@ -1,10 +1,3 @@ -DECLARE SUB delay (seconds AS SINGLE) -DECLARE SUB drawGridCell (x%, y%) -DECLARE SUB clearTail (playerNumber%) -DECLARE SUB start () -DECLARE SUB stuff () -DECLARE SUB stat () - ' Game of worms. ' ' Game supports up to 5 players. Any amount of those players can be AI controlled. @@ -24,7 +17,7 @@ DECLARE SUB stat () ' Changelog: ' 2002, Initial version -' 2024, Improved program readability using AI +' 2024-2005, Improved program readability DECLARE FUNCTION cnum$ (a%) DECLARE SUB putworm (a%) @@ -296,13 +289,12 @@ SUB autop (a%) END IF END SUB -' This subroutine takes care of clearing out worm tail. -' As form head advances forword in each frame, this procedure -' is responsible for clearing out squares where worm tail moved out -' of. Such squares are marked as empty (no longer occupied by worm) -' and also correspondingly are erased from the screen. SUB clearTail (playerNumber) - + ' This subroutine takes care of clearing out worm tail. + ' As worm head advances forward in each frame, this procedure + ' is responsible for clearing out squares where worm tail moved out + ' of. Such squares are marked as empty (no longer occupied by worm) + ' and also correspondingly are erased from the screen. a = ussp(playerNumber) - ussl(playerNumber) IF a < 1 THEN @@ -336,14 +328,12 @@ SUB dead (a%) putworm a END SUB -' Since QBasic does not have precise timer suitable for delaying animations, -' workaround here is to use SOUND function. Inaudible sound with frequency -' of 0 Hz is produced. Second argument for SOUND function is sound duration -' that is approximately 1/18'th of the second. SUB delay (delayInSeconds AS SINGLE) - -SOUND 0, delayInSeconds * 18 - + ' Since QBasic does not have precise timer suitable for delaying animations, + ' workaround here is to use SOUND function. Inaudible sound with frequency + ' of 0 Hz is produced. Second argument for SOUND function is sound duration + ' that is approximately 1/18'th of the second. + SOUND 0, delayInSeconds * 18 END SUB SUB drawGridCell (x%, y%) @@ -886,4 +876,3 @@ SUB tkt prc a NEXT a END SUB -