Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51280

Re: How would I do this?

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.048
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'column': 0.07; 'indicating': 0.07; 'nested': 0.07; 'subject:would': 0.07; 'spaces': 0.09; 'subject:How': 0.10; 'code?': 0.16; 'loops': 0.16; 'accordingly.': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'print': 0.22; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'strongly': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; 'reply.': 0.31; '25,': 0.31; 'with,': 0.31; 'basic': 0.35; 'board': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'should': 0.36; 'implement': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'space': 0.40; 'how': 0.40; 'skip:u 10': 0.60; "you'll": 0.62; 'more': 0.64; 'jul': 0.74; 'square': 0.74; 'subject:this': 0.83; 'compact,': 0.84; 'labels.': 0.93; '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; bh=h6ycgIm+0OI1F55Gn0TM9ip61x9ukFQfZeeu+3ASNdo=; b=LlCaso1KOPL+S7EiNUE/VRM5wc41Ke1dckistXkwK7HFyykvdgcllwJQBMT6Ex2a1A g6xHUZmyF8C6RRpjKWbKUKCm9mAGlTpRjKSJYZR18686gYfeprFANC+n0ZvQiMVS9DbV YXkQJpN6o/OxUqLqn1NryOD4BeEo/nzv6MBFP7CILDTHwlZgKCCEGMRfRJiyBQtmNfwr B/zExvAymrDvgronlxy1kIibYdm2wGnAv0z06oqHXIUuMBfvbXFQzjavlYy+NHyOQ/Mf Lu38RVazsBXGfw+REsGPQYzkBBIZK4/s52RMBkPaeDAehVFMbaVHscMIZVaUMY8K3tMr XoKQ==
X-Received by 10.66.164.199 with SMTP id ys7mr5515707pab.104.1374811378779; Thu, 25 Jul 2013 21:02:58 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <a8abab99-374f-422a-8e3a-5f0cb21f7a8a@googlegroups.com>
References <a68a52f8-a9f2-438c-a728-402dadf822f6@googlegroups.com> <mailman.5130.1374809568.3114.python-list@python.org> <a8abab99-374f-422a-8e3a-5f0cb21f7a8a@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 25 Jul 2013 22:02:18 -0600
Subject Re: How would I do this?
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5131.1374811387.3114.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374811387 news.xs4all.nl 15916 [2001:888:2000:d::a6]:55290
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51280

Show key headers only | View raw


On Thu, Jul 25, 2013 at 9:40 PM,  <h4ck3rpr0n3@gmail.com> wrote:
> Thank you for the quick reply. Unfortunately I'm still a little confused... How might I implement that into my current code?

Where you print spaces indicating an empty space, you need to look up
the current square in the board data structure to see what is
contained there (whether it's an empty space or not) and print it
accordingly.

I strongly recommend that you work out how to print the board using
nested for loops instead of all those individual print statements.
The result will be more compact, easier to work with, and less
error-prone.  The basic skeleton should look something like this:

for row in range(8):
    for column in range(8):
        print(board[row][column])

Which you'll need to embellish with the row and column dividers and labels.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How would I do this? John Doe <h4ck3rpr0n3@gmail.com> - 2013-07-25 20:16 -0700
  Re: How would I do this? Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-25 21:31 -0600
    Re: How would I do this? h4ck3rpr0n3@gmail.com - 2013-07-25 20:40 -0700
      Re: How would I do this? Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-25 22:02 -0600

csiph-web