9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Friedrich Psiorz <f.psiorz@gmx.de>
To: 9fans@9fans.net
Subject: Re: [9fans] a simple chess board for plan9
Date: Tue,  3 Sep 2013 15:13:52 +0200	[thread overview]
Message-ID: <5225E090.9010706@gmx.de> (raw)
In-Reply-To: <CAM4fmbS=dHwgq=XULou8bogoXvO0wTt7CSP9_XA8c9L736cyQw@mail.gmail.com>

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
>




  reply	other threads:[~2013-09-03 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 12:06 Travis Moore
2013-09-03 13:13 ` Friedrich Psiorz [this message]
2013-09-03 14:01 ` Matthew Veety
2013-09-04 22:22   ` Travis Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5225E090.9010706@gmx.de \
    --to=f.psiorz@gmx.de \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).