9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] a simple chess board for plan9
@ 2013-09-03 12:06 Travis Moore
  2013-09-03 13:13 ` Friedrich Psiorz
  2013-09-03 14:01 ` Matthew Veety
  0 siblings, 2 replies; 4+ messages in thread
From: Travis Moore @ 2013-09-03 12:06 UTC (permalink / raw)
  To: 9fans

I was a little surprised at the lack of chess resources for something
which came out of bell labs.  I'm not about to contribute an engine,
but I did end up writing this graphical program to help me keep track
of my correspondence games:

http://runjimmyrunrunyoufuckerrun.com/src/chessbd.tgz

It doesn't check moves or anything, but it can load, save, and play
back games.  It also accepts among its arguments a strict form of
portable game notation, so that you can, for example, run:

chessbd 1.e4 c5 2.c3 e6 3.d4 d5 4.exd5 exd5 \
5.Nf3 Bd6 6.Be3 c4 7.b3 cxb3 8.axb3 Ne7 \
9.Na3 Nbc6 10.Nb5 Bb8 11.Bd3 Bf5 12.c4 O-O \
13.Ra4 Qd7 14.Nc3 Bc7 15.Bxf5 Qxf5 16.Nh4 Qd7 \
17.O-O Rad8 18.Re1 Rfe8 19.c5 Ba5 20.Qd3 a6 \
21.h3 Bxc3 22.Qxc3 Nf5 23.Nxf5 Qxf5 24.Ra2 Re6 \
25.Rae2 Rde8 26.Qd2 f6 27.Qc3 h5 28.b4 R8e7 \
29.Kh1 g5 30.Kg1 g4 31.h4 Re4 32.Qb2 Na7 \
33.Qd2 R4e6 34.Qc1 Nb5 35.Qd2 Na3 36.Qd1 Kf7 \
37.Qb3 Nc4 38.Kh2 Re4 39.g3 Qf3 40.b5 a5 \
41.c6 f5 42.cxb7 Rxb7 43.Kg1 f4 44.gxf4 g3 \
45.Qd1 Rbe7 46.b6 gxf2 47.Rxf2 Qxd1 48.Rxd1 Rxe3 \
49.Rg2 Nxb6 50.Rg5 a4 51.Rxh5 a3 52.Rd2 Re2  0-1

then use the arrow keys to step through Kasparov's game against Deep
Thought (press down, then right repeatedly).

This is my first program in C, let alone for plan9, so any comments or
suggestions are most welcome,

Travis



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] a simple chess board for plan9
  2013-09-03 12:06 [9fans] a simple chess board for plan9 Travis Moore
@ 2013-09-03 13:13 ` Friedrich Psiorz
  2013-09-03 14:01 ` Matthew Veety
  1 sibling, 0 replies; 4+ messages in thread
From: Friedrich Psiorz @ 2013-09-03 13:13 UTC (permalink / raw)
  To: 9fans

Great work!

Maybe the mkfile could be improved a bit; I had to copy the images manually.

And since you're asking for comments on your C style ...
imho, most of it looks really good; maybe you could try to avoid deep
nesting of control structures.

if(cond1) {
	if(cond2) {
		...
	}
}

should be changed to

if(cond1 && cond2) {
	...
}

and

while(...) {
	if(cond) {
		...
	}
}

should be changed to

while(...) {
	if(!cond)
		continue;

	...
}

Am 03.09.2013 14:06, schrieb Travis Moore:
> I was a little surprised at the lack of chess resources for something
> which came out of bell labs.  I'm not about to contribute an engine,
> but I did end up writing this graphical program to help me keep track
> of my correspondence games:
>
> http://runjimmyrunrunyoufuckerrun.com/src/chessbd.tgz
>
> It doesn't check moves or anything, but it can load, save, and play
> back games.  It also accepts among its arguments a strict form of
> portable game notation, so that you can, for example, run:
>
> chessbd 1.e4 c5 2.c3 e6 3.d4 d5 4.exd5 exd5 \
> 5.Nf3 Bd6 6.Be3 c4 7.b3 cxb3 8.axb3 Ne7 \
> 9.Na3 Nbc6 10.Nb5 Bb8 11.Bd3 Bf5 12.c4 O-O \
> 13.Ra4 Qd7 14.Nc3 Bc7 15.Bxf5 Qxf5 16.Nh4 Qd7 \
> 17.O-O Rad8 18.Re1 Rfe8 19.c5 Ba5 20.Qd3 a6 \
> 21.h3 Bxc3 22.Qxc3 Nf5 23.Nxf5 Qxf5 24.Ra2 Re6 \
> 25.Rae2 Rde8 26.Qd2 f6 27.Qc3 h5 28.b4 R8e7 \
> 29.Kh1 g5 30.Kg1 g4 31.h4 Re4 32.Qb2 Na7 \
> 33.Qd2 R4e6 34.Qc1 Nb5 35.Qd2 Na3 36.Qd1 Kf7 \
> 37.Qb3 Nc4 38.Kh2 Re4 39.g3 Qf3 40.b5 a5 \
> 41.c6 f5 42.cxb7 Rxb7 43.Kg1 f4 44.gxf4 g3 \
> 45.Qd1 Rbe7 46.b6 gxf2 47.Rxf2 Qxd1 48.Rxd1 Rxe3 \
> 49.Rg2 Nxb6 50.Rg5 a4 51.Rxh5 a3 52.Rd2 Re2  0-1
>
> then use the arrow keys to step through Kasparov's game against Deep
> Thought (press down, then right repeatedly).
>
> This is my first program in C, let alone for plan9, so any comments or
> suggestions are most welcome,
>
> Travis
>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] a simple chess board for plan9
  2013-09-03 12:06 [9fans] a simple chess board for plan9 Travis Moore
  2013-09-03 13:13 ` Friedrich Psiorz
@ 2013-09-03 14:01 ` Matthew Veety
  2013-09-04 22:22   ` Travis Moore
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Veety @ 2013-09-03 14:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sep 3, 2013, at 8:06, Travis Moore <travis@varspool.com> wrote:

> I was a little surprised at the lack of chess resources for something
> which came out of bell labs.  I'm not about to contribute an engine,
> but I did end up writing this graphical program to help me keep track
> of my correspondence games:
>
> http://runjimmyrunrunyoufuckerrun.com/src/chessbd.tgz
>
> It doesn't check moves or anything, but it can load, save, and play
> back games.  It also accepts among its arguments a strict form of
> portable game notation, so that you can, for example, run:
>
> chessbd 1.e4 c5 2.c3 e6 3.d4 d5 4.exd5 exd5 \
> 5.Nf3 Bd6 6.Be3 c4 7.b3 cxb3 8.axb3 Ne7 \
> 9.Na3 Nbc6 10.Nb5 Bb8 11.Bd3 Bf5 12.c4 O-O \
> 13.Ra4 Qd7 14.Nc3 Bc7 15.Bxf5 Qxf5 16.Nh4 Qd7 \
> 17.O-O Rad8 18.Re1 Rfe8 19.c5 Ba5 20.Qd3 a6 \
> 21.h3 Bxc3 22.Qxc3 Nf5 23.Nxf5 Qxf5 24.Ra2 Re6 \
> 25.Rae2 Rde8 26.Qd2 f6 27.Qc3 h5 28.b4 R8e7 \
> 29.Kh1 g5 30.Kg1 g4 31.h4 Re4 32.Qb2 Na7 \
> 33.Qd2 R4e6 34.Qc1 Nb5 35.Qd2 Na3 36.Qd1 Kf7 \
> 37.Qb3 Nc4 38.Kh2 Re4 39.g3 Qf3 40.b5 a5 \
> 41.c6 f5 42.cxb7 Rxb7 43.Kg1 f4 44.gxf4 g3 \
> 45.Qd1 Rbe7 46.b6 gxf2 47.Rxf2 Qxd1 48.Rxd1 Rxe3 \
> 49.Rg2 Nxb6 50.Rg5 a4 51.Rxh5 a3 52.Rd2 Re2  0-1
>
> then use the arrow keys to step through Kasparov's game against Deep
> Thought (press down, then right repeatedly).
>
> This is my first program in C, let alone for plan9, so any comments or
> suggestions are most welcome,
>
> Travis
>

Styles good and seems to work quite well. Nice work!

PS: your domain name is beautiful.

Veety



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] a simple chess board for plan9
  2013-09-03 14:01 ` Matthew Veety
@ 2013-09-04 22:22   ` Travis Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Travis Moore @ 2013-09-04 22:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

thanks for the comments, guys



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-04 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 12:06 [9fans] a simple chess board for plan9 Travis Moore
2013-09-03 13:13 ` Friedrich Psiorz
2013-09-03 14:01 ` Matthew Veety
2013-09-04 22:22   ` Travis Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).