From: Svjatoslav Agejenko Date: Wed, 4 Sep 2024 22:00:53 +0000 (+0300) Subject: Better directory and file names X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=dd0450c411d3ca15078dcb613ff60bcb04de8b2e;p=qbasicapps.git Better directory and file names --- diff --git a/Simulation/Explosion/explode.bas b/Simulation/Explosion/explode.bas new file mode 100755 index 0000000..54e0482 --- /dev/null +++ b/Simulation/Explosion/explode.bas @@ -0,0 +1,202 @@ +' Material simulation, simulates shockwaves propagation in gas. +' made by Svjatoslav Agejenko +' in 2003 +' homepage: svjatoslav.eu +' email: svjatoslav@svjatoslav.eu + +DECLARE SUB saveit () +DECLARE SUB playit () +DECLARE SUB frmget () +DECLARE SUB frmsav () +DECLARE SUB spot (x!, y!, p!) +DECLARE SUB lin (x1!, y1!, x2!, y2!) +DECLARE SUB disp () +DECLARE SUB start () +DIM SHARED wal +wal = 9980 + +DIM SHARED press(1 TO 100, 1 TO 100) +DIM SHARED spdx(1 TO 100, 1 TO 100) +DIM SHARED spdy(1 TO 100, 1 TO 100) +DIM SHARED spdxp(1 TO 100, 1 TO 100) +DIM SHARED spdyp(1 TO 100, 1 TO 100) +DIM SHARED nam$, frm +DIM SHARED linb AS STRING * 100 +frm = 0 + +SCREEN 13 +PAINT (1, 1), 1 + +OPEN "tst.an0" FOR BINARY AS #1 + + +start + +1 +'disp + +FOR y = 2 TO 99 + FOR x = 2 TO 99 + IF press(x, y) = wal THEN spdx(x - 1, y) = 0: spdy(x, y - 1) = 0: spdx(x, y) = 0: spdy(x, y) = 0: GOTO 3 + spdy(x, y) = spdy(x, y) - (press(x, y) / 500) ' gravitation + + IF press(x + 1, y) = wal THEN spdx(x, y) = 0: GOTO 2 + spdx(x, y) = (press(x + 1, y) - press(x, y)) / 20 + spdx(x, y) + 2 + IF press(x, y + 1) = wal THEN spdy(x, y) = 0: GOTO 3 + spdy(x, y) = (press(x, y + 1) - press(x, y)) / 20 + spdy(x, y) + 3 + NEXT x +NEXT y + + +4 +b = 0 +FOR y = 2 TO 99 + FOR x = 2 TO 99 + a = press(x, y) + spdx(x, y) + spdy(x, y) - spdx(x - 1, y) - spdy(x, y - 1) + + IF a = 0 OR ((a < 0) AND (a > -.0001)) THEN + IF spdx(x, y) < 0 THEN spdx(x, y) = 0 + IF spdy(x, y) < 0 THEN spdy(x, y) = 0 + IF spdx(x - 1, y) > 0 THEN spdx(x - 1, y) = 0 + IF spdy(x, y - 1) > 0 THEN spdy(x, y - 1) = 0 + END IF + + IF a < 0 THEN + IF spdx(x, y) < 0 THEN spdx(x, y) = spdx(x, y) / 1.5 + IF spdy(x, y) < 0 THEN spdy(x, y) = spdy(x, y) / 1.5 + IF spdx(x - 1, y) > 0 THEN spdx(x - 1, y) = spdx(x - 1, y) / 1.5 + IF spdy(x, y - 1) > 0 THEN spdy(x, y - 1) = spdy(x, y - 1) / 1.5 + b = 1 + LOCATE 20, 1 + PRINT a + END IF + NEXT x +NEXT y +IF b = 1 THEN GOTO 4 + +FOR y = 2 TO 99 + FOR x = 2 TO 99 + IF spdx(x, y) > 0 THEN spdxp(x - 1, y) = ((press(x, y) * spdx(x - 1, y)) + (spdx(x, y) * spdx(x, y))) / (press(x, y) + spdx(x, y)) - spdx(x - 1, y) + IF spdy(x, y) > 0 THEN spdyp(x, y - 1) = ((press(x, y) * spdy(x, y - 1)) + (spdy(x, y) * spdy(x, y))) / (press(x, y) + spdy(x, y)) - spdy(x, y - 1) + IF spdx(x - 1, y) < 0 THEN spdxp(x, y) = ((press(x, y) * spdx(x, y)) - (spdx(x - 1, y) * spdx(x - 1, y))) / (press(x, y) - spdx(x - 1, y)) - spdx(x, y) + IF spdy(x, y - 1) < 0 THEN spdyp(x, y) = ((press(x, y) * spdy(x, y)) - (spdy(x, y - 1) * spdy(x, y - 1))) / (press(x, y) - spdy(x, y - 1)) - spdy(x, y) + NEXT x +NEXT y + + +FOR y = 2 TO 99 + FOR x = 2 TO 99 + press(x + 1, y) = press(x + 1, y) - spdx(x, y) + press(x, y + 1) = press(x, y + 1) - spdy(x, y) + press(x, y) = press(x, y) + spdx(x, y) + press(x, y) = press(x, y) + spdy(x, y) + NEXT x +NEXT y + +FOR y = 2 TO 99 + FOR x = 2 TO 99 + spdx(x, y) = spdx(x, y) + spdxp(x, y) + spdxp(x, y) = 0 + spdy(x, y) = spdy(x, y) + spdyp(x, y) + spdyp(x, y) = 0 + NEXT x +NEXT y + + +FOR y = 1 TO 100 + FOR x = 1 TO 100 + PSET (x, y), press(x, y) + 16 + NEXT x +NEXT y + +saveit + + + + +GOTO 1 + +CLOSE #1 + +SUB disp +FOR y = 47 TO 53 + FOR x = 47 TO 53 + LOCATE y - 46, (x - 46) * 4 + PRINT press(x, y) + NEXT x +NEXT y + +a$ = INPUT$(1) + +END SUB + +SUB lin (x1, y1, x2, y2) + +m = ABS(x1 - x2) +m1 = ABS(y1 - y2) +IF m1 > m THEN m = m1 + +x3 = x2 - x1 +y3 = y2 - y1 + +FOR a = 0 TO m + x5 = x3 * a / m + x1 + y5 = y3 * a / m + y1 + press(x5, y5) = wal +NEXT a + + +END SUB + +SUB saveit +FOR y = 1 TO 100 + a$ = "" + FOR x = 1 TO 100 + a$ = a$ + CHR$(POINT(x, y)) + NEXT x + linb = a$ + PUT #1, , linb +NEXT y + + +END SUB + +SUB spot (x, y, p) +press(x, y) = p +press(x + 1, y) = p +press(x, y + 1) = p +press(x + 1, y + 1) = p +END SUB + +SUB start +frm = 0 + +FOR a = 1 TO 100 + FOR b = 1 TO 100 + press(a, b) = 3 + spdx(a, b) = 0 + spdy(a, b) = 0 + spdxp(a, b) = 0 + spdyp(a, b) = 0 + NEXT b +NEXT a + +FOR y = 30 TO 60 + FOR x = 10 TO 50 + spot x, y, 30 + NEXT x +NEXT y + +lin 2, 2, 2, 99 +lin 99, 2, 99, 99 +lin 2, 99, 99, 99 +lin 2, 2, 99, 2 + +FOR x = 5 TO 40 STEP 5 + lin x, 80, x + 50, 80 - x +NEXT x + +END SUB + diff --git a/Simulation/Explosion/index.html b/Simulation/Explosion/index.html new file mode 100644 index 0000000..e0410d6 --- /dev/null +++ b/Simulation/Explosion/index.html @@ -0,0 +1,17 @@ + +explode + + + +

explode

+
+
+
Simulates air flow. +Air tries to spread equally around space, +while having is inertial farces, mass and gravitation. +Simulation animates shock waves propagation on +flat space after explosion. + +
+ + \ No newline at end of file diff --git a/Simulation/Explosion/sshot.png b/Simulation/Explosion/sshot.png new file mode 100644 index 0000000..80089b6 Binary files /dev/null and b/Simulation/Explosion/sshot.png differ diff --git a/Simulation/Game of life/1 b/Simulation/Game of life/1 new file mode 100644 index 0000000..b411c92 --- /dev/null +++ b/Simulation/Game of life/1 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +........####...................................... +.......#....#..................................... +........####...................................... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +................................#######........... +...............................#.......#.......... +................................#######........... +.................................................. +.................................................. +.................................................. +.................................................. +........#####..................................... +.......#.....#.................................... +........#####..................................... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +................................######............ +...............................#......#........... +................................######............ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/10 b/Simulation/Game of life/10 new file mode 100644 index 0000000..08af0fb --- /dev/null +++ b/Simulation/Game of life/10 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +........................###....................... +.....................#.......#.................... +....................#.........#................... +........................###....................... +.......................#...#...................... +...................#..#.....#..#.................. +...................#..#.....#..#.................. +...................#..#.....#..#.................. +.......................#...#...................... +........................###....................... +....................#.........#................... +.....................#.......#.................... +........................###....................... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/11 b/Simulation/Game of life/11 new file mode 100644 index 0000000..5b8cf86 --- /dev/null +++ b/Simulation/Game of life/11 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +........................###....................... +.....................#...#...#.................... +....................##...#...##................... +......................#.###.#..................... +.......................#...#...................... +...................#..#.....#..#.................. +...................####.....####.................. +...................#..#.....#..#.................. +.......................#...#...................... +......................#.###.#..................... +....................##...#...##................... +.....................#...#...#.................... +........................###....................... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/2 b/Simulation/Game of life/2 new file mode 100644 index 0000000..b5ebe02 --- /dev/null +++ b/Simulation/Game of life/2 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +...............##................................. +...............#.................................. +.................#................................ +.............#####................................ +.............#.................................... +...........##...##................................ +.......##.#....##.#.##............................ +........#.#....##.#.#............................. +.......#..##....#.#..#............................ +........##..#.#....##............................. +..........#.#######............................... +..........#.......#............................... +...........#######................................ +.................................................. +.............###.................................. +............#..#.................................. +............##..................##................ +...............................#..#.##............ +...............................#.##.#.#........... +..............................##..#.#.#........... +.............................#..#.#...#.##........ +.............................##.#.#...#..#........ +................................#.#.#..##......... +................................#.#.##.#.......... +.................................##.#..#.......... +.....................................##........... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/3 b/Simulation/Game of life/3 new file mode 100644 index 0000000..f904a0b --- /dev/null +++ b/Simulation/Game of life/3 @@ -0,0 +1,50 @@ +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. +.................................................. +.................................................. +.................................................. +.................................................. +.##.##.##.##.##.##.##.##.##.##.##.##.............. +.##.##.##.##.##.##.##.##.##.##.##.##.............. +...........................................###.... +.##.##.##.##.##.##.##.##.##.##.##.##.......#...... +.##.##.##.##.##.##.##.##.##.##.##.##........#..... +.................................................. +.................................................. diff --git a/Simulation/Game of life/4 b/Simulation/Game of life/4 new file mode 100644 index 0000000..da991a7 --- /dev/null +++ b/Simulation/Game of life/4 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +........................#......................... +.......................###........................ +.......................#.#........................ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/5 b/Simulation/Game of life/5 new file mode 100644 index 0000000..064f56e --- /dev/null +++ b/Simulation/Game of life/5 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +..............................#................... +.............................###.................. +...............................#.................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/6 b/Simulation/Game of life/6 new file mode 100644 index 0000000..fc66375 --- /dev/null +++ b/Simulation/Game of life/6 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +......###.....#...#...#...#...#...#...#...#....... +......#.#.....#...#...#...#...#...#...#...#....... +......###.....#...#...#...#...#...#...#...#....... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.............#..#..#..#..#..#..#..#..#............ +.............#..#..#..#..#..#..#..#..#............ +.............#..#..#..#..#..#..#..#..#............ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/7 b/Simulation/Game of life/7 new file mode 100644 index 0000000..e008167 --- /dev/null +++ b/Simulation/Game of life/7 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.......###........................................ +.........#........................................ +........#......................................... +.................................................. +........................................###....... +........................................#......... +.........................................#........ +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/8 b/Simulation/Game of life/8 new file mode 100644 index 0000000..bb71aee --- /dev/null +++ b/Simulation/Game of life/8 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................#.#.#.#.#.#.#.................... +..................#.#.#.#.#.#..................... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/9 b/Simulation/Game of life/9 new file mode 100644 index 0000000..ded468e --- /dev/null +++ b/Simulation/Game of life/9 @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +....................................##............ +..................................##..#........... +............#####.................#..##........... +..........#.......#................##............. +.........#.........#.............................. +.............###.................................. +........#...#...#...#............................. +........#..#.....#..#............................. +........#..#.....#..#............................. +........#..#.....#..#............................. +........#...#...#...#............................. +.............###.................................. +.........#.........#.............................. +..........#.......#............................... +............#####................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +...................................#####.......... +.................................##.....##........ +................................#.........#....... +................................#...###...#....... +...............................#...#...#...#...... +...............................#..#.....#..#...... +...............................#..#.....#..#...... +........#......................#..#.....#..#...... +........##.##..................#...#...#...#...... +............#...................#...###...#....... +................................#.........#....... +.................................##.....##........ +...................................#####.......... +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/e b/Simulation/Game of life/e new file mode 100644 index 0000000..1ca8715 --- /dev/null +++ b/Simulation/Game of life/e @@ -0,0 +1,50 @@ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................####.............####............ +.....................#...........#................ +...................####.........#................. +.......................#...#...#.................. +........................#.#.#.#................... +.................#########...#########............ +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. +.................................................. diff --git a/Simulation/Game of life/index.html b/Simulation/Game of life/index.html new file mode 100644 index 0000000..ce986cd --- /dev/null +++ b/Simulation/Game of life/index.html @@ -0,0 +1,12 @@ + +life + + + +

life

+
Conway's game of life. Simple editor with copy and paste +functionality and simulator. + +
+ + \ No newline at end of file diff --git a/Simulation/Game of life/life.bas b/Simulation/Game of life/life.bas new file mode 100755 index 0000000..e8b12fb --- /dev/null +++ b/Simulation/Game of life/life.bas @@ -0,0 +1,390 @@ +' Conway's Game of Life. +' It has world editor, and can save/load worlds. +' +' By Svjatoslav Agejenko. +' Email: svjatoslav@svjatoslav.eu +' Homepage: http://www.svjatoslav.eu +' +' Changelog: +' 2001, Initial version +' 2024.08, Improved program readability using AI + +' in observing mode use keys: +' --------------------------- + +' x - run for 10000 cycles +' s - run for specified amount of cycles +' n - run for 1 cycle +' z - stop running +' c - clear all +' w - write state to file +' l - load state from file +' e - switch to edit mode +' q - quit + +' in edit mode use keys: +' ---------------------- + +' cursor keys - move around +' 4 8 6 2 - move arund in large jumps +' s - switch to select mode +' v - paste from copy buffer +' SPACE - toggle cell on/off +' ESC - return to observing mode + +' in select mode use keys: +' ------------------------ + +' cursor keys - select area +' 4 8 6 2 - select area in large jumps +' c - copy +' x - cut +' ESC - return to edit mode + +DECLARE SUB loadFile () +DECLARE SUB writeFile () +DECLARE SUB showBuffer () +DEFINT A-Z + +DECLARE SUB selectMode (x, y) +DECLARE SUB clearBuffers () +DECLARE SUB editMode () +DECLARE SUB displayGrid () +DECLARE SUB clearLine () +DECLARE SUB processLife () +DECLARE SUB initialize () +DIM SHARED buffer1(1 TO 50, 1 TO 50) +DIM SHARED buffer2(1 TO 50, 1 TO 50) +DIM SHARED millisecond +DIM SHARED frame +DIM SHARED skip +DIM SHARED buffer3(0 TO 50, 0 TO 50) +DIM SHARED bufferXSize, bufferYSize +initialize + +1 +processLife +frame = frame + 1 + +2 +LOCATE 1, 27 +PRINT "frame:" + STR$(frame) + " " +LOCATE 2, 27 +PRINT "skip:" + STR$(skip) + " " + +key$ = INKEY$ + +IF key$ = "s" THEN + LOCATE 5, 27 + INPUT "skip ", skip + clearLine +END IF + +IF key$ = "q" THEN + SYSTEM +END IF + +IF key$ = "n" THEN GOTO 1 + +IF key$ = "c" THEN clearBuffers + +IF key$ = "e" THEN editMode + +IF key$ = "z" THEN skip = 0 + +IF key$ = "x" THEN skip = 10000 + +IF key$ = "w" THEN writeFile + +IF key$ = "l" THEN loadFile + +IF skip > 0 THEN + skip = skip - 1 + GOTO 1 +END IF +GOTO 2 + +SUB clearBuffers + +FOR y = 1 TO 50 + FOR x = 1 TO 50 + buffer1(x, y) = 0 + buffer2(x, y) = 0 + NEXT x +NEXT y + +millisecond = 0 +frame = 0 +skip = 0 + +displayGrid +END SUB + +SUB clearLine +LOCATE 5, 27 +PRINT " " +END SUB + +SUB displayGrid + +FOR y = 1 TO 50 + FOR x = 1 TO 50 + IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) + IF clr = 0 THEN clr = 1 ELSE clr = 10 + LINE (x * 4, y * 4)-(x * 4 + 2, y * 4 + 2), clr, BF + NEXT x +NEXT y + +END SUB + +SUB editMode +x = 25 +y = 25 +3 +IF x < 1 THEN x = 1 +IF y < 1 THEN y = 1 +IF x > 50 THEN x = 50 +IF y > 49 THEN y = 49 + +IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) +IF clr = 0 THEN clr = 1 ELSE clr = 10 +LINE (x * 4, y * 4)-(x * 4 + 2, y * 4 + 2), clr, BF + +LINE (x * 4 - 1, y * 4 - 1)-(x * 4 + 3, y * 4 + 3), 14, B +4 +key$ = INKEY$ +IF key$ = "" THEN GOTO 4 + +LINE (x * 4 - 1, y * 4 - 1)-(x * 4 + 3, y * 4 + 3), 0, B + +IF key$ = CHR$(0) + "M" THEN x = x + 1 +IF key$ = CHR$(0) + "K" THEN x = x - 1 +IF key$ = CHR$(0) + "P" THEN y = y + 1 +IF key$ = CHR$(0) + "H" THEN y = y - 1 +IF key$ = "6" THEN x = x + 8 +IF key$ = "4" THEN x = x - 8 +IF key$ = "2" THEN y = y + 8 +IF key$ = "8" THEN y = y - 8 + +IF key$ = CHR$(27) THEN GOTO 5 +IF key$ = "s" THEN selectMode x, y + +IF key$ = "v" THEN + FOR y1 = 0 TO bufferYSize + FOR x1 = 0 TO bufferXSize + clr = buffer3(x1, y1) + x2 = x1 + x + y2 = y1 + y + + IF (x2 < 50) AND (y2 < 50) THEN + IF millisecond = 0 THEN buffer1(x2, y2) = clr ELSE buffer2(x2, y2) = clr + END IF + + NEXT x1 + NEXT y1 + displayGrid +END IF + +IF key$ = " " THEN + IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) + IF clr = 1 THEN clr = 0 ELSE clr = 1 + IF millisecond = 0 THEN buffer1(x, y) = clr ELSE buffer2(x, y) = clr +END IF + +GOTO 3 +5 + +END SUB + +SUB initialize +SCREEN 13 +RANDOMIZE TIMER + +bufferXSize = 0 +bufferYSize = 0 + +clearBuffers + +END SUB + +SUB loadFile + +clearBuffers +LOCATE 5, 27 +INPUT "file ", filename$ +clearLine + +y = 1 +OPEN filename$ FOR INPUT AS #1 +9 +IF EOF(1) <> 0 THEN GOTO 10 + +LINE INPUT #1, line$ + +FOR x = 1 TO LEN(line$) + char$ = RIGHT$(LEFT$(line$, x), 1) + IF char$ = "#" THEN clr = 1 ELSE clr = 0 + IF millisecond = 0 THEN buffer1(x, y) = clr ELSE buffer2(x, y) = clr +NEXT x +y = y + 1 + +GOTO 9 +10 +CLOSE #1 +displayGrid + +END SUB + +SUB processLife + +IF millisecond = 0 THEN + FOR y = 2 TO 48 + FOR x = 2 TO 49 + IF buffer1(x - 1, y - 1) = 1 THEN count = 1 ELSE count = 0 + IF buffer1(x, y - 1) = 1 THEN count = count + 1 + IF buffer1(x + 1, y - 1) = 1 THEN count = count + 1 + IF buffer1(x - 1, y) = 1 THEN count = count + 1 + IF buffer1(x + 1, y) = 1 THEN count = count + 1 + IF buffer1(x - 1, y + 1) = 1 THEN count = count + 1 + IF buffer1(x, y + 1) = 1 THEN count = count + 1 + IF buffer1(x + 1, y + 1) = 1 THEN count = count + 1 + + IF buffer1(x, y) = 1 THEN + IF count = 2 OR count = 3 THEN buffer2(x, y) = 1 ELSE buffer2(x, y) = 0 + ELSE + IF count = 3 THEN buffer2(x, y) = 1 ELSE buffer2(x, y) = 0 + END IF + + NEXT x + NEXT y + millisecond = 1 + displayGrid +ELSE + + FOR y = 2 TO 48 + FOR x = 2 TO 49 + IF buffer2(x - 1, y - 1) = 1 THEN count = 1 ELSE count = 0 + IF buffer2(x, y - 1) = 1 THEN count = count + 1 + IF buffer2(x + 1, y - 1) = 1 THEN count = count + 1 + IF buffer2(x - 1, y) = 1 THEN count = count + 1 + IF buffer2(x + 1, y) = 1 THEN count = count + 1 + IF buffer2(x - 1, y + 1) = 1 THEN count = count + 1 + IF buffer2(x, y + 1) = 1 THEN count = count + 1 + IF buffer2(x + 1, y + 1) = 1 THEN count = count + 1 + + IF buffer2(x, y) = 1 THEN + IF count = 2 OR count = 3 THEN buffer1(x, y) = 1 ELSE buffer1(x, y) = 0 + ELSE + IF count = 3 THEN buffer1(x, y) = 1 ELSE buffer1(x, y) = 0 + END IF + NEXT x + NEXT y + + millisecond = 0 + displayGrid +END IF + +END SUB + +SUB selectMode (x, y) +x1 = x * 4 - 1 +y1 = y * 4 - 1 +x2 = x + 2 +y2 = y + 2 + +6 +x3 = x2 * 4 + 3 +y3 = y2 * 4 + 3 + +LINE (x1, y1)-(x3, y3), 14, B +8 +key$ = INKEY$ +IF key$ = "" THEN GOTO 8 +LINE (x1, y1)-(x3, y3), 0, B + +IF key$ = CHR$(0) + "M" THEN x2 = x2 + 1 +IF key$ = CHR$(0) + "K" THEN x2 = x2 - 1 +IF key$ = CHR$(0) + "P" THEN y2 = y2 + 1 +IF key$ = CHR$(0) + "H" THEN y2 = y2 - 1 + +IF key$ = "6" THEN x2 = x2 + 8 +IF key$ = "4" THEN x2 = x2 - 8 +IF key$ = "2" THEN y2 = y2 + 8 +IF key$ = "8" THEN y2 = y2 - 8 + +IF key$ = CHR$(27) THEN GOTO 7 +IF key$ = "c" THEN + bufferXSize = x2 - x + bufferYSize = y2 - y + + FOR y4 = y TO y2 + FOR x4 = x TO x2 + IF millisecond = 0 THEN clr = buffer1(x4, y4) ELSE clr = buffer2(x4, y4) + buffer3(x4 - x, y4 - y) = clr + NEXT x4 + NEXT y4 + showBuffer +END IF + +IF key$ = "x" THEN + bufferXSize = x2 - x + bufferYSize = y2 - y + + FOR y4 = y TO y2 + FOR x4 = x TO x2 + IF millisecond = 0 THEN clr = buffer1(x4, y4): buffer1(x4, y4) = 0 ELSE clr = buffer2(x4, y4): buffer2(x4, y4) = 0 + buffer3(x4 - x, y4 - y) = clr + NEXT x4 + NEXT y4 + showBuffer + displayGrid +END IF + +GOTO 6 +7 + +END SUB + +SUB showBuffer + +'PRINT bufxs +'PRINT bufys + +x = bufferXSize +IF x > 15 THEN x = 15 +y = bufferYSize +IF y > 15 THEN y = 15 + +LINE (204, 99)-(319, 199), 0, BF +LINE (204, 99)-(208 + 4 * bufferXSize, 103 + 4 * bufferYSize), 14, B + +FOR y2 = 0 TO y + FOR x2 = 0 TO x + clr = buffer3(x2, y2) + IF clr = 0 THEN clr = 1 ELSE clr = 10 + LINE (x2 * 4 + 205, y2 * 4 + 100)-(x2 * 4 + 2 + 205, y2 * 4 + 2 + 100), clr, BF + NEXT x2 +NEXT y2 + +END SUB + +SUB writeFile +LOCATE 5, 27 +INPUT "file ", filename$ +clearLine + +OPEN filename$ FOR OUTPUT AS #1 + +FOR y = 1 TO 50 + line$ = "" + FOR x = 1 TO 50 + IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) + IF clr = 0 THEN line$ = line$ + "." ELSE line$ = line$ + "#" + NEXT x + PRINT #1, line$ +NEXT y + +CLOSE #1 + +END SUB + diff --git a/Simulation/Game of life/sshot.png b/Simulation/Game of life/sshot.png new file mode 100644 index 0000000..f1ca1c7 Binary files /dev/null and b/Simulation/Game of life/sshot.png differ diff --git a/Simulation/explosion/explode.bas b/Simulation/explosion/explode.bas deleted file mode 100755 index 54e0482..0000000 --- a/Simulation/explosion/explode.bas +++ /dev/null @@ -1,202 +0,0 @@ -' Material simulation, simulates shockwaves propagation in gas. -' made by Svjatoslav Agejenko -' in 2003 -' homepage: svjatoslav.eu -' email: svjatoslav@svjatoslav.eu - -DECLARE SUB saveit () -DECLARE SUB playit () -DECLARE SUB frmget () -DECLARE SUB frmsav () -DECLARE SUB spot (x!, y!, p!) -DECLARE SUB lin (x1!, y1!, x2!, y2!) -DECLARE SUB disp () -DECLARE SUB start () -DIM SHARED wal -wal = 9980 - -DIM SHARED press(1 TO 100, 1 TO 100) -DIM SHARED spdx(1 TO 100, 1 TO 100) -DIM SHARED spdy(1 TO 100, 1 TO 100) -DIM SHARED spdxp(1 TO 100, 1 TO 100) -DIM SHARED spdyp(1 TO 100, 1 TO 100) -DIM SHARED nam$, frm -DIM SHARED linb AS STRING * 100 -frm = 0 - -SCREEN 13 -PAINT (1, 1), 1 - -OPEN "tst.an0" FOR BINARY AS #1 - - -start - -1 -'disp - -FOR y = 2 TO 99 - FOR x = 2 TO 99 - IF press(x, y) = wal THEN spdx(x - 1, y) = 0: spdy(x, y - 1) = 0: spdx(x, y) = 0: spdy(x, y) = 0: GOTO 3 - spdy(x, y) = spdy(x, y) - (press(x, y) / 500) ' gravitation - - IF press(x + 1, y) = wal THEN spdx(x, y) = 0: GOTO 2 - spdx(x, y) = (press(x + 1, y) - press(x, y)) / 20 + spdx(x, y) - 2 - IF press(x, y + 1) = wal THEN spdy(x, y) = 0: GOTO 3 - spdy(x, y) = (press(x, y + 1) - press(x, y)) / 20 + spdy(x, y) - 3 - NEXT x -NEXT y - - -4 -b = 0 -FOR y = 2 TO 99 - FOR x = 2 TO 99 - a = press(x, y) + spdx(x, y) + spdy(x, y) - spdx(x - 1, y) - spdy(x, y - 1) - - IF a = 0 OR ((a < 0) AND (a > -.0001)) THEN - IF spdx(x, y) < 0 THEN spdx(x, y) = 0 - IF spdy(x, y) < 0 THEN spdy(x, y) = 0 - IF spdx(x - 1, y) > 0 THEN spdx(x - 1, y) = 0 - IF spdy(x, y - 1) > 0 THEN spdy(x, y - 1) = 0 - END IF - - IF a < 0 THEN - IF spdx(x, y) < 0 THEN spdx(x, y) = spdx(x, y) / 1.5 - IF spdy(x, y) < 0 THEN spdy(x, y) = spdy(x, y) / 1.5 - IF spdx(x - 1, y) > 0 THEN spdx(x - 1, y) = spdx(x - 1, y) / 1.5 - IF spdy(x, y - 1) > 0 THEN spdy(x, y - 1) = spdy(x, y - 1) / 1.5 - b = 1 - LOCATE 20, 1 - PRINT a - END IF - NEXT x -NEXT y -IF b = 1 THEN GOTO 4 - -FOR y = 2 TO 99 - FOR x = 2 TO 99 - IF spdx(x, y) > 0 THEN spdxp(x - 1, y) = ((press(x, y) * spdx(x - 1, y)) + (spdx(x, y) * spdx(x, y))) / (press(x, y) + spdx(x, y)) - spdx(x - 1, y) - IF spdy(x, y) > 0 THEN spdyp(x, y - 1) = ((press(x, y) * spdy(x, y - 1)) + (spdy(x, y) * spdy(x, y))) / (press(x, y) + spdy(x, y)) - spdy(x, y - 1) - IF spdx(x - 1, y) < 0 THEN spdxp(x, y) = ((press(x, y) * spdx(x, y)) - (spdx(x - 1, y) * spdx(x - 1, y))) / (press(x, y) - spdx(x - 1, y)) - spdx(x, y) - IF spdy(x, y - 1) < 0 THEN spdyp(x, y) = ((press(x, y) * spdy(x, y)) - (spdy(x, y - 1) * spdy(x, y - 1))) / (press(x, y) - spdy(x, y - 1)) - spdy(x, y) - NEXT x -NEXT y - - -FOR y = 2 TO 99 - FOR x = 2 TO 99 - press(x + 1, y) = press(x + 1, y) - spdx(x, y) - press(x, y + 1) = press(x, y + 1) - spdy(x, y) - press(x, y) = press(x, y) + spdx(x, y) - press(x, y) = press(x, y) + spdy(x, y) - NEXT x -NEXT y - -FOR y = 2 TO 99 - FOR x = 2 TO 99 - spdx(x, y) = spdx(x, y) + spdxp(x, y) - spdxp(x, y) = 0 - spdy(x, y) = spdy(x, y) + spdyp(x, y) - spdyp(x, y) = 0 - NEXT x -NEXT y - - -FOR y = 1 TO 100 - FOR x = 1 TO 100 - PSET (x, y), press(x, y) + 16 - NEXT x -NEXT y - -saveit - - - - -GOTO 1 - -CLOSE #1 - -SUB disp -FOR y = 47 TO 53 - FOR x = 47 TO 53 - LOCATE y - 46, (x - 46) * 4 - PRINT press(x, y) - NEXT x -NEXT y - -a$ = INPUT$(1) - -END SUB - -SUB lin (x1, y1, x2, y2) - -m = ABS(x1 - x2) -m1 = ABS(y1 - y2) -IF m1 > m THEN m = m1 - -x3 = x2 - x1 -y3 = y2 - y1 - -FOR a = 0 TO m - x5 = x3 * a / m + x1 - y5 = y3 * a / m + y1 - press(x5, y5) = wal -NEXT a - - -END SUB - -SUB saveit -FOR y = 1 TO 100 - a$ = "" - FOR x = 1 TO 100 - a$ = a$ + CHR$(POINT(x, y)) - NEXT x - linb = a$ - PUT #1, , linb -NEXT y - - -END SUB - -SUB spot (x, y, p) -press(x, y) = p -press(x + 1, y) = p -press(x, y + 1) = p -press(x + 1, y + 1) = p -END SUB - -SUB start -frm = 0 - -FOR a = 1 TO 100 - FOR b = 1 TO 100 - press(a, b) = 3 - spdx(a, b) = 0 - spdy(a, b) = 0 - spdxp(a, b) = 0 - spdyp(a, b) = 0 - NEXT b -NEXT a - -FOR y = 30 TO 60 - FOR x = 10 TO 50 - spot x, y, 30 - NEXT x -NEXT y - -lin 2, 2, 2, 99 -lin 99, 2, 99, 99 -lin 2, 99, 99, 99 -lin 2, 2, 99, 2 - -FOR x = 5 TO 40 STEP 5 - lin x, 80, x + 50, 80 - x -NEXT x - -END SUB - diff --git a/Simulation/explosion/index.html b/Simulation/explosion/index.html deleted file mode 100644 index e0410d6..0000000 --- a/Simulation/explosion/index.html +++ /dev/null @@ -1,17 +0,0 @@ - -explode - - - -

explode

-
-
-
Simulates air flow. -Air tries to spread equally around space, -while having is inertial farces, mass and gravitation. -Simulation animates shock waves propagation on -flat space after explosion. - -
- - \ No newline at end of file diff --git a/Simulation/explosion/sshot.png b/Simulation/explosion/sshot.png deleted file mode 100644 index 80089b6..0000000 Binary files a/Simulation/explosion/sshot.png and /dev/null differ diff --git a/Simulation/interf.BAS b/Simulation/interf.BAS deleted file mode 100755 index 563e27a..0000000 --- a/Simulation/interf.BAS +++ /dev/null @@ -1,70 +0,0 @@ -' Program simulates interference between two slightly different frequencies -' By Svjatoslav Agejenko. -' Email: svjatoslav@svjatoslav.eu -' Homepage: http://www.svjatoslav.eu -' -' Changelog: -' ?, Initial version -' 2024.08, Improved program readability using AI - -DECLARE SUB GetFrequency () -DECLARE SUB Start () -DECLARE FUNCTION GetY! (t!) -DIM SHARED freq(1 TO 100) -DIM SHARED phase(1 TO 100) - -Start -1 -frame = frame + 1 -PSET (0, 0) -FOR x = 0 TO 639 - - oldY1 = y1 - oldY2 = y2 - oldY3 = y3 - - y1 = GetY(frame + x / 4) * 20 + 150 - y2 = GetY(frame + x / 4 + (x / 50)) * 20 + 150 - y3 = y1 + y2 - - ' LINE (x + 1, 0)-(x + 1, 479), 12 - LINE (x, 0)-(x, 479), 0 - - LINE (x - 1, oldY1)-(x, y1), 1 - LINE (x - 1, oldY2)-(x, y2), 2 - LINE (x - 1, oldY3)-(x, y3), 15 - -NEXT x -GOTO 1 - -SUB Display -END SUB - -SUB GetFrequency - -FOR a = 1 TO 100 - freq(a) = RND / 2 + 1 -NEXT a - -FOR a = 1 TO 100 - phase(a) = RND * 100 -NEXT a - -END SUB - -FUNCTION GetY (t) - -y = 0 -FOR a = 1 TO 1 - y = y + SIN(t * freq(a) + phase(a)) -NEXT a - -GetY = y - -END FUNCTION - -SUB Start -SCREEN 12 -GetFrequency - -END SUB diff --git a/Simulation/interf2.BAS b/Simulation/interf2.BAS deleted file mode 100755 index e1150bf..0000000 --- a/Simulation/interf2.BAS +++ /dev/null @@ -1,60 +0,0 @@ -' Program simulates lot of frequencies interfering with itself. -' As a result, interferogram is produced. -' -' By Svjatoslav Agejenko. -' Email: svjatoslav@svjatoslav.eu -' Homepage: http://www.svjatoslav.eu -' -' Changelog: -' ?, Initial version -' 2024.08, Improved program readability using AI - - -DIM SHARED frequency(1 TO 100) -DIM SHARED phaseAngle(1 TO 100) - -SCREEN 12 - -PSET (0, 0) -FOR xPos = 0 TO 639 - - fs = (xPos - 320) / 5000 + 1 - ' fs = (xPos - 320) / 50 + 1 - - yVal = 0 - FOR timeStep = 1 TO 5000 STEP 5 - y1 = SIN(timeStep) - y2 = SIN(timeStep * fs) - yVal = yVal + ABS(y1 + y2) - NEXT timeStep - - yVal = yVal / 5 - IF yVal > 470 THEN yVal = 470 - IF yVal < 0 THEN yVal = 0 - - LINE -(xPos, 479 - yVal), 15 - -NEXT xPos - -SUB getFrequencies - - ' Generates random frequencies and phase angles - FOR index = 1 TO 100 - frequency(index) = RND / 7 + 1 - NEXT index - - FOR index = 1 TO 100 - phaseAngle(index) = RND * 100 - NEXT index - -END SUB - -SUB getYVal (timeStep) - - yVal = 0 - ' Sum of sinusoids with different frequencies and phases - FOR index = 1 TO 100 - yVal = yVal + SIN(timeStep * frequency(index) + phaseAngle(index)) - NEXT index - -END SUB diff --git a/Simulation/interference.BAS b/Simulation/interference.BAS new file mode 100755 index 0000000..563e27a --- /dev/null +++ b/Simulation/interference.BAS @@ -0,0 +1,70 @@ +' Program simulates interference between two slightly different frequencies +' By Svjatoslav Agejenko. +' Email: svjatoslav@svjatoslav.eu +' Homepage: http://www.svjatoslav.eu +' +' Changelog: +' ?, Initial version +' 2024.08, Improved program readability using AI + +DECLARE SUB GetFrequency () +DECLARE SUB Start () +DECLARE FUNCTION GetY! (t!) +DIM SHARED freq(1 TO 100) +DIM SHARED phase(1 TO 100) + +Start +1 +frame = frame + 1 +PSET (0, 0) +FOR x = 0 TO 639 + + oldY1 = y1 + oldY2 = y2 + oldY3 = y3 + + y1 = GetY(frame + x / 4) * 20 + 150 + y2 = GetY(frame + x / 4 + (x / 50)) * 20 + 150 + y3 = y1 + y2 + + ' LINE (x + 1, 0)-(x + 1, 479), 12 + LINE (x, 0)-(x, 479), 0 + + LINE (x - 1, oldY1)-(x, y1), 1 + LINE (x - 1, oldY2)-(x, y2), 2 + LINE (x - 1, oldY3)-(x, y3), 15 + +NEXT x +GOTO 1 + +SUB Display +END SUB + +SUB GetFrequency + +FOR a = 1 TO 100 + freq(a) = RND / 2 + 1 +NEXT a + +FOR a = 1 TO 100 + phase(a) = RND * 100 +NEXT a + +END SUB + +FUNCTION GetY (t) + +y = 0 +FOR a = 1 TO 1 + y = y + SIN(t * freq(a) + phase(a)) +NEXT a + +GetY = y + +END FUNCTION + +SUB Start +SCREEN 12 +GetFrequency + +END SUB diff --git a/Simulation/interferogram.BAS b/Simulation/interferogram.BAS new file mode 100755 index 0000000..e1150bf --- /dev/null +++ b/Simulation/interferogram.BAS @@ -0,0 +1,60 @@ +' Program simulates lot of frequencies interfering with itself. +' As a result, interferogram is produced. +' +' By Svjatoslav Agejenko. +' Email: svjatoslav@svjatoslav.eu +' Homepage: http://www.svjatoslav.eu +' +' Changelog: +' ?, Initial version +' 2024.08, Improved program readability using AI + + +DIM SHARED frequency(1 TO 100) +DIM SHARED phaseAngle(1 TO 100) + +SCREEN 12 + +PSET (0, 0) +FOR xPos = 0 TO 639 + + fs = (xPos - 320) / 5000 + 1 + ' fs = (xPos - 320) / 50 + 1 + + yVal = 0 + FOR timeStep = 1 TO 5000 STEP 5 + y1 = SIN(timeStep) + y2 = SIN(timeStep * fs) + yVal = yVal + ABS(y1 + y2) + NEXT timeStep + + yVal = yVal / 5 + IF yVal > 470 THEN yVal = 470 + IF yVal < 0 THEN yVal = 0 + + LINE -(xPos, 479 - yVal), 15 + +NEXT xPos + +SUB getFrequencies + + ' Generates random frequencies and phase angles + FOR index = 1 TO 100 + frequency(index) = RND / 7 + 1 + NEXT index + + FOR index = 1 TO 100 + phaseAngle(index) = RND * 100 + NEXT index + +END SUB + +SUB getYVal (timeStep) + + yVal = 0 + ' Sum of sinusoids with different frequencies and phases + FOR index = 1 TO 100 + yVal = yVal + SIN(timeStep * frequency(index) + phaseAngle(index)) + NEXT index + +END SUB diff --git a/Simulation/life/1 b/Simulation/life/1 deleted file mode 100644 index b411c92..0000000 --- a/Simulation/life/1 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -........####...................................... -.......#....#..................................... -........####...................................... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -................................#######........... -...............................#.......#.......... -................................#######........... -.................................................. -.................................................. -.................................................. -.................................................. -........#####..................................... -.......#.....#.................................... -........#####..................................... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -................................######............ -...............................#......#........... -................................######............ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/10 b/Simulation/life/10 deleted file mode 100644 index 08af0fb..0000000 --- a/Simulation/life/10 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -........................###....................... -.....................#.......#.................... -....................#.........#................... -........................###....................... -.......................#...#...................... -...................#..#.....#..#.................. -...................#..#.....#..#.................. -...................#..#.....#..#.................. -.......................#...#...................... -........................###....................... -....................#.........#................... -.....................#.......#.................... -........................###....................... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/11 b/Simulation/life/11 deleted file mode 100644 index 5b8cf86..0000000 --- a/Simulation/life/11 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -........................###....................... -.....................#...#...#.................... -....................##...#...##................... -......................#.###.#..................... -.......................#...#...................... -...................#..#.....#..#.................. -...................####.....####.................. -...................#..#.....#..#.................. -.......................#...#...................... -......................#.###.#..................... -....................##...#...##................... -.....................#...#...#.................... -........................###....................... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/2 b/Simulation/life/2 deleted file mode 100644 index b5ebe02..0000000 --- a/Simulation/life/2 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -...............##................................. -...............#.................................. -.................#................................ -.............#####................................ -.............#.................................... -...........##...##................................ -.......##.#....##.#.##............................ -........#.#....##.#.#............................. -.......#..##....#.#..#............................ -........##..#.#....##............................. -..........#.#######............................... -..........#.......#............................... -...........#######................................ -.................................................. -.............###.................................. -............#..#.................................. -............##..................##................ -...............................#..#.##............ -...............................#.##.#.#........... -..............................##..#.#.#........... -.............................#..#.#...#.##........ -.............................##.#.#...#..#........ -................................#.#.#..##......... -................................#.#.##.#.......... -.................................##.#..#.......... -.....................................##........... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/3 b/Simulation/life/3 deleted file mode 100644 index f904a0b..0000000 --- a/Simulation/life/3 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.. -.................................................. -.................................................. -.................................................. -.................................................. -.##.##.##.##.##.##.##.##.##.##.##.##.............. -.##.##.##.##.##.##.##.##.##.##.##.##.............. -...........................................###.... -.##.##.##.##.##.##.##.##.##.##.##.##.......#...... -.##.##.##.##.##.##.##.##.##.##.##.##........#..... -.................................................. -.................................................. diff --git a/Simulation/life/4 b/Simulation/life/4 deleted file mode 100644 index da991a7..0000000 --- a/Simulation/life/4 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -........................#......................... -.......................###........................ -.......................#.#........................ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/5 b/Simulation/life/5 deleted file mode 100644 index 064f56e..0000000 --- a/Simulation/life/5 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -..............................#................... -.............................###.................. -...............................#.................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/6 b/Simulation/life/6 deleted file mode 100644 index fc66375..0000000 --- a/Simulation/life/6 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -......###.....#...#...#...#...#...#...#...#....... -......#.#.....#...#...#...#...#...#...#...#....... -......###.....#...#...#...#...#...#...#...#....... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.............#..#..#..#..#..#..#..#..#............ -.............#..#..#..#..#..#..#..#..#............ -.............#..#..#..#..#..#..#..#..#............ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/7 b/Simulation/life/7 deleted file mode 100644 index e008167..0000000 --- a/Simulation/life/7 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.......###........................................ -.........#........................................ -........#......................................... -.................................................. -........................................###....... -........................................#......... -.........................................#........ -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/8 b/Simulation/life/8 deleted file mode 100644 index bb71aee..0000000 --- a/Simulation/life/8 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................#.#.#.#.#.#.#.................... -..................#.#.#.#.#.#..................... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/9 b/Simulation/life/9 deleted file mode 100644 index ded468e..0000000 --- a/Simulation/life/9 +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -....................................##............ -..................................##..#........... -............#####.................#..##........... -..........#.......#................##............. -.........#.........#.............................. -.............###.................................. -........#...#...#...#............................. -........#..#.....#..#............................. -........#..#.....#..#............................. -........#..#.....#..#............................. -........#...#...#...#............................. -.............###.................................. -.........#.........#.............................. -..........#.......#............................... -............#####................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -...................................#####.......... -.................................##.....##........ -................................#.........#....... -................................#...###...#....... -...............................#...#...#...#...... -...............................#..#.....#..#...... -...............................#..#.....#..#...... -........#......................#..#.....#..#...... -........##.##..................#...#...#...#...... -............#...................#...###...#....... -................................#.........#....... -.................................##.....##........ -...................................#####.......... -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/e b/Simulation/life/e deleted file mode 100644 index 1ca8715..0000000 --- a/Simulation/life/e +++ /dev/null @@ -1,50 +0,0 @@ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................####.............####............ -.....................#...........#................ -...................####.........#................. -.......................#...#...#.................. -........................#.#.#.#................... -.................#########...#########............ -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. -.................................................. diff --git a/Simulation/life/index.html b/Simulation/life/index.html deleted file mode 100644 index ce986cd..0000000 --- a/Simulation/life/index.html +++ /dev/null @@ -1,12 +0,0 @@ - -life - - - -

life

-
Conway's game of life. Simple editor with copy and paste -functionality and simulator. - -
- - \ No newline at end of file diff --git a/Simulation/life/life.bas b/Simulation/life/life.bas deleted file mode 100755 index e8b12fb..0000000 --- a/Simulation/life/life.bas +++ /dev/null @@ -1,390 +0,0 @@ -' Conway's Game of Life. -' It has world editor, and can save/load worlds. -' -' By Svjatoslav Agejenko. -' Email: svjatoslav@svjatoslav.eu -' Homepage: http://www.svjatoslav.eu -' -' Changelog: -' 2001, Initial version -' 2024.08, Improved program readability using AI - -' in observing mode use keys: -' --------------------------- - -' x - run for 10000 cycles -' s - run for specified amount of cycles -' n - run for 1 cycle -' z - stop running -' c - clear all -' w - write state to file -' l - load state from file -' e - switch to edit mode -' q - quit - -' in edit mode use keys: -' ---------------------- - -' cursor keys - move around -' 4 8 6 2 - move arund in large jumps -' s - switch to select mode -' v - paste from copy buffer -' SPACE - toggle cell on/off -' ESC - return to observing mode - -' in select mode use keys: -' ------------------------ - -' cursor keys - select area -' 4 8 6 2 - select area in large jumps -' c - copy -' x - cut -' ESC - return to edit mode - -DECLARE SUB loadFile () -DECLARE SUB writeFile () -DECLARE SUB showBuffer () -DEFINT A-Z - -DECLARE SUB selectMode (x, y) -DECLARE SUB clearBuffers () -DECLARE SUB editMode () -DECLARE SUB displayGrid () -DECLARE SUB clearLine () -DECLARE SUB processLife () -DECLARE SUB initialize () -DIM SHARED buffer1(1 TO 50, 1 TO 50) -DIM SHARED buffer2(1 TO 50, 1 TO 50) -DIM SHARED millisecond -DIM SHARED frame -DIM SHARED skip -DIM SHARED buffer3(0 TO 50, 0 TO 50) -DIM SHARED bufferXSize, bufferYSize -initialize - -1 -processLife -frame = frame + 1 - -2 -LOCATE 1, 27 -PRINT "frame:" + STR$(frame) + " " -LOCATE 2, 27 -PRINT "skip:" + STR$(skip) + " " - -key$ = INKEY$ - -IF key$ = "s" THEN - LOCATE 5, 27 - INPUT "skip ", skip - clearLine -END IF - -IF key$ = "q" THEN - SYSTEM -END IF - -IF key$ = "n" THEN GOTO 1 - -IF key$ = "c" THEN clearBuffers - -IF key$ = "e" THEN editMode - -IF key$ = "z" THEN skip = 0 - -IF key$ = "x" THEN skip = 10000 - -IF key$ = "w" THEN writeFile - -IF key$ = "l" THEN loadFile - -IF skip > 0 THEN - skip = skip - 1 - GOTO 1 -END IF -GOTO 2 - -SUB clearBuffers - -FOR y = 1 TO 50 - FOR x = 1 TO 50 - buffer1(x, y) = 0 - buffer2(x, y) = 0 - NEXT x -NEXT y - -millisecond = 0 -frame = 0 -skip = 0 - -displayGrid -END SUB - -SUB clearLine -LOCATE 5, 27 -PRINT " " -END SUB - -SUB displayGrid - -FOR y = 1 TO 50 - FOR x = 1 TO 50 - IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) - IF clr = 0 THEN clr = 1 ELSE clr = 10 - LINE (x * 4, y * 4)-(x * 4 + 2, y * 4 + 2), clr, BF - NEXT x -NEXT y - -END SUB - -SUB editMode -x = 25 -y = 25 -3 -IF x < 1 THEN x = 1 -IF y < 1 THEN y = 1 -IF x > 50 THEN x = 50 -IF y > 49 THEN y = 49 - -IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) -IF clr = 0 THEN clr = 1 ELSE clr = 10 -LINE (x * 4, y * 4)-(x * 4 + 2, y * 4 + 2), clr, BF - -LINE (x * 4 - 1, y * 4 - 1)-(x * 4 + 3, y * 4 + 3), 14, B -4 -key$ = INKEY$ -IF key$ = "" THEN GOTO 4 - -LINE (x * 4 - 1, y * 4 - 1)-(x * 4 + 3, y * 4 + 3), 0, B - -IF key$ = CHR$(0) + "M" THEN x = x + 1 -IF key$ = CHR$(0) + "K" THEN x = x - 1 -IF key$ = CHR$(0) + "P" THEN y = y + 1 -IF key$ = CHR$(0) + "H" THEN y = y - 1 -IF key$ = "6" THEN x = x + 8 -IF key$ = "4" THEN x = x - 8 -IF key$ = "2" THEN y = y + 8 -IF key$ = "8" THEN y = y - 8 - -IF key$ = CHR$(27) THEN GOTO 5 -IF key$ = "s" THEN selectMode x, y - -IF key$ = "v" THEN - FOR y1 = 0 TO bufferYSize - FOR x1 = 0 TO bufferXSize - clr = buffer3(x1, y1) - x2 = x1 + x - y2 = y1 + y - - IF (x2 < 50) AND (y2 < 50) THEN - IF millisecond = 0 THEN buffer1(x2, y2) = clr ELSE buffer2(x2, y2) = clr - END IF - - NEXT x1 - NEXT y1 - displayGrid -END IF - -IF key$ = " " THEN - IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) - IF clr = 1 THEN clr = 0 ELSE clr = 1 - IF millisecond = 0 THEN buffer1(x, y) = clr ELSE buffer2(x, y) = clr -END IF - -GOTO 3 -5 - -END SUB - -SUB initialize -SCREEN 13 -RANDOMIZE TIMER - -bufferXSize = 0 -bufferYSize = 0 - -clearBuffers - -END SUB - -SUB loadFile - -clearBuffers -LOCATE 5, 27 -INPUT "file ", filename$ -clearLine - -y = 1 -OPEN filename$ FOR INPUT AS #1 -9 -IF EOF(1) <> 0 THEN GOTO 10 - -LINE INPUT #1, line$ - -FOR x = 1 TO LEN(line$) - char$ = RIGHT$(LEFT$(line$, x), 1) - IF char$ = "#" THEN clr = 1 ELSE clr = 0 - IF millisecond = 0 THEN buffer1(x, y) = clr ELSE buffer2(x, y) = clr -NEXT x -y = y + 1 - -GOTO 9 -10 -CLOSE #1 -displayGrid - -END SUB - -SUB processLife - -IF millisecond = 0 THEN - FOR y = 2 TO 48 - FOR x = 2 TO 49 - IF buffer1(x - 1, y - 1) = 1 THEN count = 1 ELSE count = 0 - IF buffer1(x, y - 1) = 1 THEN count = count + 1 - IF buffer1(x + 1, y - 1) = 1 THEN count = count + 1 - IF buffer1(x - 1, y) = 1 THEN count = count + 1 - IF buffer1(x + 1, y) = 1 THEN count = count + 1 - IF buffer1(x - 1, y + 1) = 1 THEN count = count + 1 - IF buffer1(x, y + 1) = 1 THEN count = count + 1 - IF buffer1(x + 1, y + 1) = 1 THEN count = count + 1 - - IF buffer1(x, y) = 1 THEN - IF count = 2 OR count = 3 THEN buffer2(x, y) = 1 ELSE buffer2(x, y) = 0 - ELSE - IF count = 3 THEN buffer2(x, y) = 1 ELSE buffer2(x, y) = 0 - END IF - - NEXT x - NEXT y - millisecond = 1 - displayGrid -ELSE - - FOR y = 2 TO 48 - FOR x = 2 TO 49 - IF buffer2(x - 1, y - 1) = 1 THEN count = 1 ELSE count = 0 - IF buffer2(x, y - 1) = 1 THEN count = count + 1 - IF buffer2(x + 1, y - 1) = 1 THEN count = count + 1 - IF buffer2(x - 1, y) = 1 THEN count = count + 1 - IF buffer2(x + 1, y) = 1 THEN count = count + 1 - IF buffer2(x - 1, y + 1) = 1 THEN count = count + 1 - IF buffer2(x, y + 1) = 1 THEN count = count + 1 - IF buffer2(x + 1, y + 1) = 1 THEN count = count + 1 - - IF buffer2(x, y) = 1 THEN - IF count = 2 OR count = 3 THEN buffer1(x, y) = 1 ELSE buffer1(x, y) = 0 - ELSE - IF count = 3 THEN buffer1(x, y) = 1 ELSE buffer1(x, y) = 0 - END IF - NEXT x - NEXT y - - millisecond = 0 - displayGrid -END IF - -END SUB - -SUB selectMode (x, y) -x1 = x * 4 - 1 -y1 = y * 4 - 1 -x2 = x + 2 -y2 = y + 2 - -6 -x3 = x2 * 4 + 3 -y3 = y2 * 4 + 3 - -LINE (x1, y1)-(x3, y3), 14, B -8 -key$ = INKEY$ -IF key$ = "" THEN GOTO 8 -LINE (x1, y1)-(x3, y3), 0, B - -IF key$ = CHR$(0) + "M" THEN x2 = x2 + 1 -IF key$ = CHR$(0) + "K" THEN x2 = x2 - 1 -IF key$ = CHR$(0) + "P" THEN y2 = y2 + 1 -IF key$ = CHR$(0) + "H" THEN y2 = y2 - 1 - -IF key$ = "6" THEN x2 = x2 + 8 -IF key$ = "4" THEN x2 = x2 - 8 -IF key$ = "2" THEN y2 = y2 + 8 -IF key$ = "8" THEN y2 = y2 - 8 - -IF key$ = CHR$(27) THEN GOTO 7 -IF key$ = "c" THEN - bufferXSize = x2 - x - bufferYSize = y2 - y - - FOR y4 = y TO y2 - FOR x4 = x TO x2 - IF millisecond = 0 THEN clr = buffer1(x4, y4) ELSE clr = buffer2(x4, y4) - buffer3(x4 - x, y4 - y) = clr - NEXT x4 - NEXT y4 - showBuffer -END IF - -IF key$ = "x" THEN - bufferXSize = x2 - x - bufferYSize = y2 - y - - FOR y4 = y TO y2 - FOR x4 = x TO x2 - IF millisecond = 0 THEN clr = buffer1(x4, y4): buffer1(x4, y4) = 0 ELSE clr = buffer2(x4, y4): buffer2(x4, y4) = 0 - buffer3(x4 - x, y4 - y) = clr - NEXT x4 - NEXT y4 - showBuffer - displayGrid -END IF - -GOTO 6 -7 - -END SUB - -SUB showBuffer - -'PRINT bufxs -'PRINT bufys - -x = bufferXSize -IF x > 15 THEN x = 15 -y = bufferYSize -IF y > 15 THEN y = 15 - -LINE (204, 99)-(319, 199), 0, BF -LINE (204, 99)-(208 + 4 * bufferXSize, 103 + 4 * bufferYSize), 14, B - -FOR y2 = 0 TO y - FOR x2 = 0 TO x - clr = buffer3(x2, y2) - IF clr = 0 THEN clr = 1 ELSE clr = 10 - LINE (x2 * 4 + 205, y2 * 4 + 100)-(x2 * 4 + 2 + 205, y2 * 4 + 2 + 100), clr, BF - NEXT x2 -NEXT y2 - -END SUB - -SUB writeFile -LOCATE 5, 27 -INPUT "file ", filename$ -clearLine - -OPEN filename$ FOR OUTPUT AS #1 - -FOR y = 1 TO 50 - line$ = "" - FOR x = 1 TO 50 - IF millisecond = 0 THEN clr = buffer1(x, y) ELSE clr = buffer2(x, y) - IF clr = 0 THEN line$ = line$ + "." ELSE line$ = line$ + "#" - NEXT x - PRINT #1, line$ -NEXT y - -CLOSE #1 - -END SUB - diff --git a/Simulation/life/sshot.png b/Simulation/life/sshot.png deleted file mode 100644 index f1ca1c7..0000000 Binary files a/Simulation/life/sshot.png and /dev/null differ