Re: "Battleship" style game

2009-03-26 Thread Falstaff
On Feb 25, 10:11 pm, Zvezdan Petkovic wrote: > On Feb 25, 2009, at 3:54 PM, Shawn Milochik wrote: > > > It is true that it would be fewer lines of code with the same > > functionality, but it's better practice to have that framework in > > place so that any changes made in the future wouldn't brea

Re: "Battleship" style game

2009-03-11 Thread Shawn Milochik
Thanks for the tips, everybody. I've cleaned it up, and learned some useful things from your comments and the reading they led to. http://shawnmilo.com/ships/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "Battleship" style game

2009-02-26 Thread Lie
On Feb 26, 3:50 am, Shawn Milochik wrote: > On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani wrote: > > > Yes it's in Python alright, but it's not Pythonese yet. You could try > > avoiding the getter/setter stuff, and camelCase method naming, things like > > that, for a start. > > > -- > >http://m

Re: "Battleship" style game

2009-02-25 Thread Zvezdan Petkovic
On Feb 25, 2009, at 3:54 PM, Shawn Milochik wrote: It is true that it would be fewer lines of code with the same functionality, but it's better practice to have that framework in place so that any changes made in the future wouldn't break any of the code accessing my class. Obviously this is a fa

Re: "Battleship" style game

2009-02-25 Thread Jean-Paul Calderone
On Wed, 25 Feb 2009 15:54:46 -0500, Shawn Milochik wrote: On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: Not really. The point about properties is that you *can* make attribute access trigger getter or setter code. But not that you do unless there is an actual reason for that. The

Re: "Battleship" style game

2009-02-25 Thread Grant Edwards
On 2009-02-25, Diez B. Roggisch wrote: > Don't waste time coding for a future you can't even pretend to > know. Do what is needed to solve the actual problem. Premature obfuscation is even worse than premature optimization. -- Grant Edwards grante Yow! Well, O.K.

Re: "Battleship" style game

2009-02-25 Thread Diez B. Roggisch
Shawn Milochik schrieb: On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: Not really. The point about properties is that you *can* make attribute access trigger getter or setter code. But not that you do unless there is an actual reason for that. The way you do it now is simply introdu

Re: "Battleship" style game

2009-02-25 Thread J. Cliff Dyer
On Wed, 2009-02-25 at 15:54 -0500, Shawn Milochik wrote: > On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: > > > Not really. The point about properties is that you *can* make attribute > > access trigger getter or setter code. > > > > But not that you do unless there is an actual reason

Re: "Battleship" style game

2009-02-25 Thread Steve Holden
Shawn Milochik wrote: > On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: > >> Not really. The point about properties is that you *can* make attribute >> access trigger getter or setter code. >> >> But not that you do unless there is an actual reason for that. The way you >> do it now is s

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: > Not really. The point about properties is that you *can* make attribute > access trigger getter or setter code. > > But not that you do unless there is an actual reason for that. The way you > do it now is simply introducing clutter, with

Re: "Battleship" style game

2009-02-25 Thread Diez B. Roggisch
Shawn Milochik schrieb: Thanks. I wasn't aware of the property() function, but I read up on it. I modified the Vessels.py file, but not the board file (except where necessary to handle the changes made to Vessels. Is this better? http://shawnmilo.com/ships/ships2/ Not really. The point about

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
Thanks. I wasn't aware of the property() function, but I read up on it. I modified the Vessels.py file, but not the board file (except where necessary to handle the changes made to Vessels. Is this better? http://shawnmilo.com/ships/ships2/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "Battleship" style game

2009-02-25 Thread Gabriel Genellina
En Wed, 25 Feb 2009 14:50:18 -0200, Shawn Milochik escribió: On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani wrote: Yes it's in Python alright, but it's not Pythonese yet. You could try avoiding the getter/setter stuff, and camelCase method naming, things like that, for a start. What d

Re: "Battleship" style game

2009-02-25 Thread Steve Holden
Shawn Milochik wrote: > On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani wrote: >> Yes it's in Python alright, but it's not Pythonese yet. You could try >> avoiding the getter/setter stuff, and camelCase method naming, things like >> that, for a start. >> >> -- >> http://mail.python.org/mailman/lis

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani wrote: > > Yes it's in Python alright, but it's not Pythonese yet. You could try > avoiding the getter/setter stuff, and camelCase method naming, things like > that, for a start. > > -- > http://mail.python.org/mailman/listinfo/python-list > What d

Re: "Battleship" style game

2009-02-25 Thread Marco Mariani
Shawn Milochik wrote: > I'm not claiming it's bulletproof, but it works. I just kind of came up with all the methods off of the top of my head, so if anyone has any suggestions for more elegant or efficient code, please let me know. Yes it's in Python alright, but it's not Pythonese yet. You

"Battleship" style game

2009-02-25 Thread Shawn Milochik
I started learning Java for fun, and the first project assignment in the book is to create a game like "Battleship." So, of course, I wrote it in Python first, just for fun. I haven't had the time to look up all the Java syntax. So, here it is, fully functional. I thought I'd throw it out there an