On Mon, Sep 28, 2009 at 3:27 PM, Ethan Furman wrote:
> Simon Forman wrote:
>>
>> On Sun, Sep 27, 2009 at 12:40 PM, Someone Something
>> wrote:
>>
>>> I'm trying to write a little tic-tac-toe program I need a array/list such
>>> that I can represent the tic tac toe board with an x axis and y axis
Simon Forman wrote:
On Sun, Sep 27, 2009 at 12:40 PM, Someone Something
wrote:
I'm trying to write a little tic-tac-toe program I need a array/list such
that I can represent the tic tac toe board with an x axis and y axis and i
can access each square to find out whether there is an X or an O.
On Sun, Sep 27, 2009 at 12:40 PM, Someone Something
wrote:
> I'm trying to write a little tic-tac-toe program I need a array/list such
> that I can represent the tic tac toe board with an x axis and y axis and i
> can access each square to find out whether there is an X or an O. I have
> absolutel
On Sun, 27 Sep 2009 17:40:57 +0100, Someone Something
wrote:
I'm trying to write a little tic-tac-toe program I need a array/list such
that I can represent the tic tac toe board with an x axis and y axis and
i
can access each square to find out whether there is an X or an O. I have
absolut
Someone Something wrote:
I'm trying to write a little tic-tac-toe program I need a array/list
such that I can represent the tic tac toe board with an x axis and y
axis and i can access each square to find out whether there is an X or
an O. I have absolutely no idea how to do this in python and
I'm trying to write a little tic-tac-toe program I need a array/list such
that I can represent the tic tac toe board with an x axis and y axis and i
can access each square to find out whether there is an X or an O. I have
absolutely no idea how to do this in python and I really, really, don't want
pdlem...@earthlink.net, if you are using Psyco and you aren't using
NumPy and you want max speed you may use:
NROWS = 24
NCOLS = 75
screen = array("H", [0]) * (NROWS * NCOLS)
and then you can use items like this:
screen[r * NCOLS + c]
(If NCOLS is equal or a bit lower than a power of 2 it's bette
On 2009-06-06 14:48, pdlem...@earthlink.net wrote:
All attempts have failed.
import WConio
import array
screen = array.array('H',[0]*75,[0]*24)
ERR array takes at most 2 arguments
screen = array.array('H',[0]*75[0]*24)
In pdlem...@earthlink.net writes:
>All attempts have failed.
>import WConio
>import array
>screen = array.array('H',[0]*75,[0]*24)
> ERR array takes at most 2 arguments
>screen = array.array('H',[0]*75[0]*24)
>T
All attempts have failed.
import WConio
import array
screen = array.array('H',[0]*75,[0]*24)
ERR array takes at most 2 arguments
screen = array.array('H',[0]*75[0]*24)
TypeErr int object is unsubscriptable
Horacius ReX wrote:
> do you know how to do similar but in two dimensions ?
Investigate the numpy module if you are dealing with numbers.
Jeremy
--
Jeremy Sanders
http://www.jeremysanders.net/
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
DATA = [ [ 0 for i in range(ncolumns) ] for i in range(nrows) ]
Is one way.
DON'T do it like this:
row = [0] * ncolumns
data = [ row ] * nrows # WRONG!
Since after that, every row is the exact same object; if you set data[0][0]
= 1, the first element of _every_ row is 1.
But I guess you a
Horacius ReX:
> do you know how to do similar but in two dimensions ?
>>> nr = 3
>>> nc = 4
>>> [[None] * nc for _ in xrange(nr)]
[[None, None, None, None], [None, None, None, None], [None, None,
None, None]]
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
in python, when I want to use arrays, I follow this way;
DATA = [0] * nint
and when I want to use I do;
DATA[i] =
do you know how to do similar but in two dimensions ?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
thanks. unravel_index do the trick.
Travis E. Oliphant wrote:
> TG wrote:
> > Hi there.
> >
> > I am working with multi-dimensional arrays and I need to get
> > coordinates of the min value in it.
> >
> > using myarray.argmin() returns the index in the flatten array, which is
> > a first step, but
TG wrote:
> Hi there.
>
> I am working with multi-dimensional arrays and I need to get
> coordinates of the min value in it.
>
> using myarray.argmin() returns the index in the flatten array, which is
> a first step, but I wonder if it is possible to get the coordinates
> directly as an array, ra
Hi there.
I am working with multi-dimensional arrays and I need to get
coordinates of the min value in it.
using myarray.argmin() returns the index in the flatten array, which is
a first step, but I wonder if it is possible to get the coordinates
directly as an array, rather than calculating them
[EMAIL PROTECTED] wrote:
Hello all,
I am trying to convert some C code into python. Since i am new to
python, i would like to know how to deal with multidimensional arrays?
Thanks,
-Joe
Here's a snippet of what i am trying to convert:
# define table0 15
# define table1 20
unsigned int Table[t
<[EMAIL PROTECTED]> wrote:
> I am trying to convert some C code into python. Since i am new to
> python, i would like to know how to deal with multidimensional arrays?
http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
might be helpful.
[EMAIL PROTECTED] wrote:
: Hello all,
: I am trying to convert some C code into python. Since i am new to
: python, i would like to know how to deal with multidimensional arrays?
Here you go:
http://python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
Also, if your
Hello all,
I am trying to convert some C code into python. Since i am new to
python, i would like to know how to deal with multidimensional arrays?
Thanks,
-Joe
Here's a snippet of what i am trying to convert:
# define table0 15
# define table1 20
unsigned int Table[table0][table1]
if(
21 matches
Mail list logo