Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.099 X-Spam-Evidence: '*H*': 0.80; '*S*': 0.00; 'indicating': 0.07; 'subject:would': 0.07; 'subject:How': 0.10; '(1,': 0.16; 'advance!': 0.16; 'coordinates': 0.16; 'guys,': 0.16; 'wrote:': 0.18; 'hey': 0.18; 'pieces': 0.19; 'thu,': 0.19; 'replace': 0.24; 'appreciated': 0.26; 'holds': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'moved': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '25,': 0.31; 'piece': 0.31; 'lists': 0.32; 'figure': 0.32; 'actual': 0.34; "can't": 0.35; 'board': 0.35; 'usual': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'representing': 0.36; 'subject:?': 0.36; 'example,': 0.37; 'list': 0.37; 'represent': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'space': 0.40; 'how': 0.40; 'black': 0.61; 'john': 0.61; 'making': 0.63; 'positions': 0.67; 'jul': 0.74; 'subject:this': 0.83; 'confusing': 0.84; 'wall.': 0.84; 'white.': 0.84; 'contents.': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=8qXU1ccSrQv6jXIvjDZhgx2hKXDnuu63JWNGiw0ZHQ4=; b=jzJTz9BIdcQz1Po92hdfEE84tKORftJ3NyXHHz/2aQXvnvyTuvPIo31I4GzhS6qcF8 BngLZg1q/ZTJStWEvpyRNBuRPoVwxMw8rg+jLQWEAxYRCWABH8P5mpTmJufQK0j+rZi3 Yoc6kBYGFIddCfbe2iAg9wg0pznH6EqzU4ALrDSJUefAFjE0PJGL2ZHwu5tIoXtht5zO 21iNbvq03FUHaOazsZ5xafiyPEsaJatczyDNE4YNrD51JWmCz48uZ+Em23S4nw5S4UlW WMX1mM83HBdAxs437RfU6z9ebP1AD3gHMHv8N4w7+hrQRDd7vaMErPKKH23GKCh/mvG8 YKiA== X-Received: by 10.66.141.71 with SMTP id rm7mr52932003pab.90.1374809559050; Thu, 25 Jul 2013 20:32:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Thu, 25 Jul 2013 21:31:58 -0600 Subject: Re: How would I do this? To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374809568 news.xs4all.nl 16000 [2001:888:2000:d::a6]:47699 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51278 On Thu, Jul 25, 2013 at 9:16 PM, John Doe wrote: > Hey guys, > > I;m working on making a chess program and I hit a wall. I have no idea ho= w to get the position of the chess pieces. I have the chess board 1-8 and A= -H for black as well as 1-8 and a-h for white. i just have to figure out ho= w to declare those positions for the actual pieces so like the row of pawns= for black would be B1-B8 as well as be able to replace the other coordinat= es with the piece when they move there like if I moved a black pawn from B1= to C1 B1 would be empty and then C1 would have it. > > I'm sorry if that's confusing but I can't seem to figure out how to do it= ... Any help is greatly appreciated and thank you in advance! The usual way to do this would be to represent the board as an 8x8 list of lists, with each item of the inner lists representing one space on the board and denoting its contents. For example, you might have board[1][4] =3D 'P', indicating that E2 (1, 4 in zero-based row-column coordinates) holds a white pawn.