Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38871
| NNTP-Posting-Date | Thu, 14 Feb 2013 11:48:10 -0600 |
|---|---|
| From | Chris Hinsley <chris.hinsley@gmail.com> |
| Newsgroups | comp.lang.python |
| Date | Thu, 14 Feb 2013 17:48:10 +0000 |
| Message-ID | <2013021417481038756-chrishinsley@gmailcom> (permalink) |
| References | <2013021323250974803-chrishinsley@gmailcom> <5evoh8p6a9sqsdq1b98ahs3ki6s4d70f9l@4ax.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Subject | Re: First attempt at a Python prog (Chess) |
| User-Agent | Unison/2.1.10 |
| Lines | 31 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-BFxJM8DAKAyIvoOLwk4aC6/Q2TlkcBjmDvuQxv77mp4x3fGbWt/VaqVLV/AIUzv7SFMtw+EPMrMrH/7!hOcEhcwIPcplufkcFPqUGu1x+PPZuhxPExyxWy6tKr2OmgY5RwGl1NobzUWuKZIOJ5ph1OOy |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2192 |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail |
| Xref | csiph.com comp.lang.python:38871 |
Show key headers only | View raw
On 2013-02-14 06:05:13 +0000, Tim Roberts said: > Chris Hinsley <chris.hinsley@gmail.com> wrote: > >> New to Python, which I really like BTW. >> >> First serious prog. Hope you like it. I know it needs a 'can't move if >> your King would be put into check' test. But the weighted value of the >> King piece does a surprising emergent job. > > It looks a little like a C program ported line-by-line to Python. For > example, in Python, there's no reason not to keep the board as an 8x8 array > instead of a 64-element list. That by itself would make the code easier to > read. It would also let you replace this: > for row in range(8): > for col in range(8): > > with the more Pythonic: > for row in board: > for cell in row: > > I would probably replace the piece_type function with a map that maps the > piece number directly to the piece Is a Python list as fast as a bytearray ? I didn't copy a C prog BTW ! Yep, after I posted the code I started thinking about how to do that sort of thing :) Thanks, for the advice. Chris
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
First attempt at a Python prog (Chess) Chris Hinsley <chris.hinsley@gmail.com> - 2013-02-13 23:25 +0000
Re: First attempt at a Python prog (Chess) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-13 23:55 +0000
Re: First attempt at a Python prog (Chess) Chris Hinsley <chris.hinsley@gmail.com> - 2013-02-14 01:31 +0000
Re: First attempt at a Python prog (Chess) Tim Roberts <timr@probo.com> - 2013-02-13 22:05 -0800
Re: First attempt at a Python prog (Chess) Chris Hinsley <chris.hinsley@gmail.com> - 2013-02-14 17:48 +0000
Re: First attempt at a Python prog (Chess) Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-14 11:30 -0700
Re: First attempt at a Python prog (Chess) Tim Roberts <timr@probo.com> - 2013-02-18 20:15 -0800
Re: First attempt at a Python prog (Chess) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 06:24 +0000
Re: First attempt at a Python prog (Chess) Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-19 12:41 -0700
Re: First attempt at a Python prog (Chess) jkn <jkn_gg@nicorp.f9.co.uk> - 2013-02-14 13:14 -0800
Re: First attempt at a Python prog (Chess) Chris Hinsley <chris.hinsley@gmail.com> - 2013-02-14 22:13 +0000
Re: First attempt at a Python prog (Chess) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-14 22:09 -0500
Re: First attempt at a Python prog (Chess) Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-14 21:05 -0800
Re: First attempt at a Python prog (Chess) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-15 11:22 +0000
Re: First attempt at a Python prog (Chess) Neil Cerutti <neilc@norwich.edu> - 2013-02-15 16:17 +0000
Re: First attempt at a Python prog (Chess) MRAB <python@mrabarnett.plus.com> - 2013-02-15 17:52 +0000
Re: First attempt at a Python prog (Chess) Neil Cerutti <neilc@norwich.edu> - 2013-02-19 21:10 +0000
Re: First attempt at a Python prog (Chess) Matt Jones <matt.walker.jones@gmail.com> - 2013-02-15 12:03 -0600
Re: First attempt at a Python prog (Chess) Tim Golden <mail@timgolden.me.uk> - 2013-02-15 11:36 +0000
Re: First attempt at a Python prog (Chess) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-15 13:11 +0000
Re: First attempt at a Python prog (Chess) Tim Golden <mail@timgolden.me.uk> - 2013-02-15 15:36 +0000
Re: First attempt at a Python prog (Chess) Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-02-15 18:48 +0200
Re: First attempt at a Python prog (Chess) Chris Angelico <rosuav@gmail.com> - 2013-02-16 02:49 +1100
Re: First attempt at a Python prog (Chess) Tim Golden <mail@timgolden.me.uk> - 2013-02-15 17:37 +0000
Re: First attempt at a Python prog (Chess) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-15 13:41 -0500
Re: First attempt at a Python prog (Chess) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-16 14:39 +0000
csiph-web