Discussion:
Connect4 for DOS in 255 bytes
(too old to reply)
Kerr-Mudd, John
2024-02-13 19:53:32 UTC
Permalink
Been a while, and the thread has expired from my usenet list, but here is
a tweaked version - it now hilites the /whole/ row when a win is
detected.
Two player game, no AI (sorry).
Cursor L/R to move current player's piece, Enter to drop. (Esc to quit).
Number of wins at top left & top right above 'board'
Uses Bios int10 for screen & int16 for keyboard.
Assumes ax=0 at start to change to 40x25 text mode.

grdb dump:

-> d 100 lFF
1639:0100 B7 B8 8E C3-8E DB CD 10-B9 06 00 BF-EC 02 B8 5F ..............._
1639:0110 77 AB E8 D8-00 AB 83 C7-3E E2 F6 B1-09 F3 AB BF w.......>.......
1639:0120 1E 05 E8 C8-00 BA 2A 00-BD 23 0C BB-4F 0E 87 EB ......*..#..O...
1639:0130 BF A4 02 89-1D B4 00 CD-16 C7 05 20-02 3C 1B 74 ........... .<.t
1639:0140 3E 3C 0D 75-3B E8 4E 00-74 E9 72 E2-88 F8 98 B1 ><.u;.N.t.r.....
1639:0150 03 D3 E0 05-3E 02 97 88-FC 4F 4F B0-30 87 05 0C ....>....OO.0...
1639:0160 30 40 3C 3A-74 F3 88 05-B1 06 BE F9-01 BF 1E 05 0@<:t...........
1639:0170 2E AC AA 47-E2 FA 98 CD-16 24 DF 3C-59 74 89 C3 ...G.....$.<Yt..
1639:0180 86 C4 2C 4B-24 02 48 D1-E0 01 F8 3C-9E 72 A4 3C ..,K$.H....<.r.<
1639:0190 AA 77 A0 97-EB 9D 89 F8-83 C7 50 80-3D 20 74 F8 .w........P.= t.
1639:01A0 83 EF 50 29-F8 74 D8 89-1D 4A 75 03-58 EB B9 B8 ..P).t...Ju.X...
1639:01B0 02 00 E8 12-00 73 35 B0-B2 E8 0B 00-73 2E 40 40 .....s5.....s.@@
1639:01C0 E8 04 00 73-27 48 48 31-C9 E8 04 00-73 1E F7 D8 ...s'HH1....s...
1639:01D0 57 49 41 01-C7 39 1D 74-F9 80 F9 03-72 0D 29 C7 WIA..9.t....r.).
1639:01E0 80 4D 01 80-29 C7 39 1D-74 F6 F8 5F-C3 50 51 B1 .M..).9.t.._.PQ.
1639:01F0 07 B8 20-02 F2 AB 59-58 C3 41 67-61 69 6E 3F .. ...YX.Again?
-> q
--
Bah, and indeed Humbug.
Kerr-Mudd, John
2024-02-14 13:51:23 UTC
Permalink
On Tue, 13 Feb 2024 19:53:32 +0000
Post by Kerr-Mudd, John
Been a while, and the thread has expired from my usenet list, but here is
a tweaked version - it now hilites the /whole/ row when a win is
detected.
Two player game, no AI (sorry).
Cursor L/R to move current player's piece, Enter to drop. (Esc to quit).
Number of wins at top left & top right above 'board'
Uses Bios int10 for screen & int16 for keyboard.
Assumes ax=0 at start to change to 40x25 text mode.
-> d 100 lFF
1639:0100 B7 B8 8E C3-8E DB CD 10-B9 06 00 BF-EC 02 B8 5F ..............._
1639:0110 77 AB E8 D8-00 AB 83 C7-3E E2 F6 B1-09 F3 AB BF w.......>.......
1639:0120 1E 05 E8 C8-00 BA 2A 00-BD 23 0C BB-4F 0E 87 EB ......*..#..O...
1639:0130 BF A4 02 89-1D B4 00 CD-16 C7 05 20-02 3C 1B 74 ........... .<.t
1639:0140 3E 3C 0D 75-3B E8 4E 00-74 E9 72 E2-88 F8 98 B1 ><.u;.N.t.r.....
1639:0150 03 D3 E0 05-3E 02 97 88-FC 4F 4F B0-30 87 05 0C ....>....OO.0...
1639:0170 2E AC AA 47-E2 FA 98 CD-16 24 DF 3C-59 74 89 C3 ...G.....$.<Yt..
1639:0180 86 C4 2C 4B-24 02 48 D1-E0 01 F8 3C-9E 72 A4 3C ..,K$.H....<.r.<
1639:0190 AA 77 A0 97-EB 9D 89 F8-83 C7 50 80-3D 20 74 F8 .w........P.= t.
1639:01A0 83 EF 50 29-F8 74 D8 89-1D 4A 75 03-58 EB B9 B8 ..P).t...Ju.X...
1639:01C0 E8 04 00 73-27 48 48 31-C9 E8 04 00-73 1E F7 D8 ...s'HH1....s...
1639:01D0 57 49 41 01-C7 39 1D 74-F9 80 F9 03-72 0D 29 C7 WIA..9.t....r.).
1639:01E0 80 4D 01 80-29 C7 39 1D-74 F6 F8 5F-C3 50 51 B1 .M..).9.t.._.PQ.
1639:01F0 07 B8 20-02 F2 AB 59-58 C3 41 67-61 69 6E 3F .. ...YX.Again?
-> q
Urgh!, it's limited to 9 wins for yellow!

-> d 100 l100
16B3:0100 B7 B8 8E C3-8E DB CD 10-B1 06 BF EC-02 B8 5F 77 .............._w
16B3:0110 AB E8 D8 00-AB 83 C7 3E-E2 F6 B1 09-F3 AB BF 1E .......>........
16B3:0120 05 E8 C8 00-BA 2A 00 BD-23 0C BB 4F-0E 87 EB BF .....*..#..O....
16B3:0130 A4 02 89 1D-B4 00 CD 16-C7 05 20 02-3C 1B 74 3E .......... .<.t>
16B3:0140 3C 0D 75 3B-E8 4E 00 74-E9 72 E2 88-F8 98 B1 03 <.u;.N.t.r......
16B3:0150 D3 E0 05 EE-01 97 88 FC-4F 4F B0 30-87 05 0C 30 ........OO.0...0
16B3:0160 40 3C 3A 74-F3 88 05 B1-06 BE F8 01-BF 1E 05 2E @<:t............
16B3:0170 AC AA 47 E2-FA 98 CD 16-24 DF 3C 59-74 8A C3 86 ..G.....$.<Yt...
16B3:0180 C4 2C 4B 24-02 48 D1 E0-01 F8 3C 9E-72 A4 3C AA .,K$.H....<.r.<.
16B3:0190 77 A0 97 EB-9D 89 F8 83-C7 50 80 3D-20 74 F8 83 w........P.= t..
16B3:01A0 EF 50 29 F8-74 D8 89 1D-4A 75 03 58-EB B9 B8 02 .P).t...Ju.X....
16B3:01B0 00 E8 12 00-73 35 B0 B2-E8 0B 00 73-2E 40 40 E8 ....s5.....s.@@.
16B3:01C0 04 00 73 27-48 48 31 C9-E8 04 00 73-1E F7 D8 57 ..s'HH1....s...W
16B3:01D0 49 41 01 C7-39 1D 74 F9-80 F9 03 72-0D 29 C7 80 IA..9.t....r.)..
16B3:01E0 4D 01 80 29-C7 39 1D 74-F6 F8 5F C3-50 51 B1 07 M..).9.t.._.PQ..
16B3:01F0 B8 20 02 F2-AB 59 58 C3-41 67 61 69-6E 3F 00 00 . ...YX.Again?..

Same code, only ScoreLine moved up 1 to avoid the current player's
piece interfering.
--
Bah, and indeed Humbug.
Kerr-Mudd, John
2024-02-19 10:39:55 UTC
Permalink
On Wed, 14 Feb 2024 13:51:23 +0000
Post by Kerr-Mudd, John
On Tue, 13 Feb 2024 19:53:32 +0000
Post by Kerr-Mudd, John
Been a while, and the thread has expired from my usenet list, but here is
a tweaked version - it now hilites the /whole/ row when a win is
detected.
Two player game, no AI (sorry).
Cursor L/R to move current player's piece, Enter to drop. (Esc to quit).
Number of wins at top left & top right above 'board'
Uses Bios int10 for screen & int16 for keyboard.
Assumes ax=0 at start to change to 40x25 text mode.
Smaller, allows space & Enter (and any ASCII key!) to drop
Must use Csr keys to move L/R.

Fixed a bug that meant a draw would have been seen before a last
placement win. "Again" message uses colour of last placed char (usually
winner), and put on the base bar.
-> d 100 lED
16AD:0100 B7 B8 8E C3-8E DB CD 10-B8 5F 77 BA-20 02 B1 06 ........._w. ...
16AD:0110 BF EC 02 AB-92 51 B1 07-F3 AB 59 92-AB 83 C7 3E .....Q....Y....>
16AD:0120 E2 F1 B1 09-F3 AB BA 2B-00 BD 23 0C-BB 4F 0E 4A .......+..#..O.J
16AD:0130 74 3A 87 EB-BF A4 02 89-1D B4 00 CD-16 C7 05 20 t:.............
16AD:0140 02 3C 1B 74-3C 3C 00 74-39 E8 4C 00-74 E9 72 DF .<.t<<.t9.L.t.r.
16AD:0150 88 F8 98 B1-03 D3 E0 05-EE 01 97 88-FC 4F 4F B0 .............OO.
16AD:0160 30 87 05 0C-30 40 3C 3A-74 F3 88 05-B1 06 BE E7 0...0@<:t.......
16AD:0170 01 BF CE 04-93 2E AC AB-E2 FB 98 CD-16 24 86 74 .............$.t
16AD:0180 87 C3 86 C4-2C 4B 24 02-48 D1 E0 01-F8 3C 9E 72 ....,K$.H....<.r
16AD:0190 A6 3C AA 77-A2 97 EB 9F-89 FE 83 C7-50 80 3D 20 .<.w........P.=
16AD:01A0 74 F8 83 EF-50 39 FE 74-D8 89 1D B1-02 E8 12 00 t...P9.t........
16AD:01B0 73 34 B1 B2-E8 0B 00 73-2D 41 41 E8-04 00 73 26 s4.....s-AA...s&
16AD:01C0 49 49 B0 00-E8 04 00 73-1D F7 D9 57-48 40 01 CF ***@..
16AD:01D0 39 1D 74 F9-3C 03 72 0D-29 CF 80 4D-01 80 29 CF 9.t.<.r.)..M..).
16AD:01E0 39 1D-74 F6 F8 5F-C3 41 67 61-69 6E 3F 9.t.._.Again?
-> q
Post by Kerr-Mudd, John
--
Bah, and indeed Humbug.
--
Bah, and indeed Humbug.
Kerr-Mudd, John
2024-02-26 12:46:52 UTC
Permalink
On Mon, 19 Feb 2024 10:39:55 +0000
Post by Kerr-Mudd, John
On Wed, 14 Feb 2024 13:51:23 +0000
Post by Kerr-Mudd, John
On Tue, 13 Feb 2024 19:53:32 +0000
Post by Kerr-Mudd, John
Been a while, and the thread has expired from my usenet list, but here is
a tweaked version - it now hilites the /whole/ row when a win is
detected.
Two player game, no AI (sorry).
Cursor L/R to move current player's piece, Enter to drop. (Esc to quit).
Number of wins at top left & top right above 'board'
Uses Bios int10 for screen & int16 for keyboard.
Assumes ax=0 at start to change to 40x25 text mode.
Smaller, allows space & Enter (and any ASCII key!) to drop
Must use Csr keys to move L/R.
Fixed a bug that meant a draw would have been seen before a last
placement win. "Again" message uses colour of last placed char (usually
winner), and put on the base bar.
Now with (1 move only!) Undo; use Tab or Bkspace.
(and corrected c.o.m.p NG's name!)

-> d 100 lF0
16B1:0100 B7 B8 8E C3-8E DB CD 10-B8 5F 77 99-B1 06 BF EC ........._w.....
16B1:0110 02 AB 92 51-B1 07 F3 AB-59 92 AB 83-C7 3E E2 F1 ...Q....Y....>..
16B1:0120 B1 09 F3 AB-B1 2B BD 23-0C BB 4F 0E-38 2D 74 08 .....+.#..O.8-t.
16B1:0130 88 2D 41 49-74 3C 87 EB-BE A4 02 89-1C B4 00 CD .-AIt<..........
16B1:0140 16 88 2C 3C-00 74 41 3C-1B 74 27 3C-0D 72 DD E8 ..,<.tA<.t'<.r..
16B1:0150 4C 00 74 E7-72 DD 88 F8-98 B1 03 D3-E0 05 EE 01 L.t.r...........
16B1:0160 97 88 FC 4F-4F B0 30 87-05 0C 30 40-3C 39 77 F3 ...OO.0...0@<9w.
16B1:0170 88 05 93 B1-06 BE EA 01-BF CE 04 2E-AC AB E2 FB ................
16B1:0180 98 CD 16 24-86 74 81 C3-86 C4 2C 4B-24 02 48 D1 ...$.t....,K$.H.
16B1:0190 E0 01 F0 3C-9E 72 A4 3C-AA 77 A0 96-EB 9D 89 F7 ...<.r.<.w......
16B1:01A0 83 C7 50 38-2D 74 F9 83-EF 50 39 FE-74 D9 89 1D ..P8-t...P9.t...
16B1:01B0 B2 02 E8 12-00 73 32 B2-B2 E8 0B 00-73 2B 42 42 .....s2.....s+BB
16B1:01C0 E8 04 00 73-24 4A 4A 31-C0 E8 02 00-F7 DA 57 48 ...s$JJ1......WH
16B1:01D0 40 01 D7 39-1D 74 F9 3C-03 72 0D 29-D7 80 4D 01 @..9.t.<.r.)..M.
16B1:01E0 80 29 D7 39-1D 74 F6 F8-5F C3 41 67-61 69 6E 3F .).9.t.._.Again?
-> q
--
Bah, and indeed Humbug.
Loading...