From syd at plug.ca  Mon May  1 17:17:50 2006
From: syd at plug.ca (syd at plug.ca)
Date: Mon, 1 May 2006 16:17:50 -0500 (CDT)
Subject: [Python Wpg] OO Python presentation proposal
Message-ID: <63509.142.132.4.215.1146518270.squirrel@mail2.plug.ca>

I have sketched out a rough outline of what I think might work for next
month's meeting. I welcome feedback on the design as well as on the
general approach to the topic.

I thought that since we had talked during the April meeting about
refactoring Starlanes-1.1 in a more object oriented way, that could form
the basis of the OO Python presentation. We'll take something we know
already (sort of) and  think about it in terms of objects.

I will need the help of others in validating my design and implementation,
so I'm going to sketch it here quickly and see what others think of the
general direction. As is usual during refactoring, I will try not to
introduce any new features -- only replicate perfectly behaviour of the
old version. The only exception to this is that I want to try to make the
game work as a server.

StarLane OO Design Overview
===========================

Class Universe represents the game board and initial values for various
game parameters. To demonstrate the object oriented principle of
inheritance, we will make Universe a subclass of (perhaps)
SimpleXMLRPCServer[1] for development into a networked, multi-player
environment. The Universe is composed of Cells.

Cells have 6 attributes:
- location (x, y)
- state (empty | start | new_base | established_company)
- up: returns the cell instance above, or None if there is no cell above
- down, left, right same as up except for direction

The Universe has the following attributes:

- A dictionary of cells keyed on a (x,y) tuple (as Jason suggested)
- max_x
- max_y
- max_turns
- max_stars
- size_x
- size_y
- current_player
- turn_counter
- create_stock: the amount of stock you get when you create a company
- dividend: percentage dividend at the beginning of every turn
- star_bonus: increase in value for proximity to star
- base_bonus: increase in value for each base
- base_cost: cost of adding a base
- displayStandings(): display the current standings of all players
- countPlayers(): returns the count of players
- nextTurn(): move the game one turn forward, change current player and
prompt for input
- cellsInState(state): how many cells on the board are in state state
- placeBase(location)
- placeCompany(location, company)


A Company has the following attributes:
- split_at: price at which the stock splits (class attribute only)
- name
- stock_value
- symbol
- active
- size
- stars: how many stars are near the company's base
- stockSplit(): perform a stock split if stock_value > split_at
- doMerger(): perform a merger with another company

A Player has the following methods and attributes:
- name
- cash
- stocks: a dictionary of the form: {stock_id: count}
- purchaseStock(company, amount): a player purchases stock from a company

[1] http://docs.python.org/lib/module-SimpleXMLRPCServer.html




From mpfaiffer at callapple.org  Tue May  2 15:48:10 2006
From: mpfaiffer at callapple.org (Mike Pfaiffer)
Date: Tue, 02 May 2006 14:48:10 -0500
Subject: [Python Wpg] OO Python presentation proposal
In-Reply-To: <63509.142.132.4.215.1146518270.squirrel@mail2.plug.ca>
References: <63509.142.132.4.215.1146518270.squirrel@mail2.plug.ca>
Message-ID: <200605021448.10639.mpfaiffer@callapple.org>

On May 1, 2006 04:17 pm, syd at plug.ca wrote this amazing epistle:
> I have sketched out a rough outline of what I think might work for next
> month's meeting. I welcome feedback on the design as well as on the
> general approach to the topic.
>
> I thought that since we had talked during the April meeting about
> refactoring Starlanes-1.1 in a more object oriented way, that could form
> the basis of the OO Python presentation. We'll take something we know
> already (sort of) and  think about it in terms of objects.
>
> I will need the help of others in validating my design and implementation,
> so I'm going to sketch it here quickly and see what others think of the
> general direction. As is usual during refactoring, I will try not to
> introduce any new features -- only replicate perfectly behaviour of the
> old version. The only exception to this is that I want to try to make the
> game work as a server.

 I'll get back to you later this week or early next with some ideas. We could 
skip directly to version 2.0 of the game since it will be a major reworking 
of the original concept. I can make space on the web page for it when it's 
ready to go public. I'd also like to submit it to the magazine as an article.

 If you like, we could work on a couple more (older) games. If we can allow 
the option of graphics or text on all of them we might be able to qualify for 
those edutainment grants Michael and Stuart were talking about. Many of the 
older games are single player only, but the concepts would allow multiplayer 
versions. I can come up with the designs and concepts, but until I'm more 
familiar with the OOP style it's going to be an education for me.

 BTW, If you and Stuart can come up with a formal announcement for the next 
presentation by 5:00pm (today - Tuesday), I can print it and bring it to the 
MWCS tonight.

    Later
    Mike



-- 
+----------------------------------------------------------------------+
|Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org |
|   http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.)      |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------


From mpfaiffer at callapple.org  Thu May  4 15:29:41 2006
From: mpfaiffer at callapple.org (Mike Pfaiffer)
Date: Thu, 04 May 2006 14:29:41 -0500
Subject: [Python Wpg] OO Python presentation proposal
In-Reply-To: <63509.142.132.4.215.1146518270.squirrel@mail2.plug.ca>
References: <63509.142.132.4.215.1146518270.squirrel@mail2.plug.ca>
Message-ID: <200605041429.42051.mpfaiffer@callapple.org>

On May 1, 2006 04:17 pm, syd at plug.ca wrote this amazing epistle:
> StarLane OO Design Overview
> ===========================
<snip>

 I've attached a document in ODF format. (you may want to have formal 
documentation to go along with the game).

 My responses are in blue. There are a couple of alternative suggestions. 
Again it's a "paradigm shift". Trying to think about things in different ways 
takes some time.

    Later
    Mike


-- 
+----------------------------------------------------------------------+
|Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org |
|   http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.)      |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: starlanes.odt
Type: application/vnd.oasis.opendocument.text
Size: 9365 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/winnipeg/attachments/20060504/4f1d418d/attachment.odt>

From sbalneav at legalaid.mb.ca  Fri May 12 10:38:06 2006
From: sbalneav at legalaid.mb.ca (Scott Balneaves)
Date: Fri, 12 May 2006 09:38:06 -0500
Subject: [Python Wpg] Window managers in Python!!
Message-ID: <20060512143806.GA16490@intmail.legalaid.mb.ca>

So, for years, I've run my own, highly modified window manager based,
originally, on evilwm.  I prefer a "minimilistic" desktop, and my window
manager has a simple two-pixel border, 8 virtual consoles, complete
keyboard control of moving and resizing windows, etc.

I've maintained this for years.  It's been a lot of fun, and taught me a
lot about window management.  It's not large, only about 1800 lines of C
code, and fairly well laid out and commented.  However, with my new love
of Python, I've often fantisized about how I might translate it.

Well low-and-behold:

http://plwm.sourceforge.net/

It looks like it's "dead upstream", as the saying goes (hasn't been
touched since 2004), but it's still very cool looking.

So, looks like I've got my next project lined up after ldapfs :)

Scott

-- 
Scott L. Balneaves | "Looking beyond the embers of bridges glowing behind us
Systems Department |  To a glimpse of how green it was on the other side..."
Legal Aid Manitoba |    -- Pink Floyd "High Hopes"


From JSCrerar at compuserve.com  Sun May 21 14:47:21 2006
From: JSCrerar at compuserve.com (Jim Crerar)
Date: Sun, 21 May 2006 12:47:21 -0600
Subject: [Python Wpg] Subject: shutil.copystat(src,dst)
Message-ID: <000c01c67d07$1aa371c0$039cc0d8@jscrerar>

Hi,
     Function shutil.copystat(src,dst) doesn't seem to work for me.
     I have created a function that will keep an output file from getting
     too large.  I do this by copying the last records to a temporary file,
     deleting the original file name, then renaming the temp file to the
     original file name.  However, I would like to keep the creation date
     of the original file.  I assume that is what copystat() is for.
     I am using Python 2.4.3 under Windows 98SE.

EXAMPLE:

import os, shutil
def Reduce_DQfile_size(DQfiles):
     ...
     # copying last 3/4 of the input file to output file.
     ...
     input.close()  # closing file DQfiles
     output.close() # closing file tmp
     shutil.copystat(DQfiles,tmp)
     os.remove(DQfiles)
     os.rename(tmp, DQfiles)
     return
     
Thanks,
Jim


From stuartw at mts.net  Tue May 23 21:46:59 2006
From: stuartw at mts.net (Stuart Williams)
Date: Tue, 23 May 2006 20:46:59 -0500
Subject: [Python Wpg] Meeting reminder, Wednesday night
Message-ID: <17523.47891.389833.986159@gargle.gargle.HOWL>

Greetings,

Don't forget that this month's meeting is Wednesday night with Syd
presenting on Object Oriented Programming in Python.

One agenda item for decision will be what we should do over summer,
i.e. meet or not, and if so when.  If you do not plan to attend this
meeting (shame, shame) but would like to weigh in on the decision,
please email your opinion either to the entire list or to someone such
as Syd or me who will be attending.

Stuart.


From sbalneav at legalaid.mb.ca  Wed May 24 15:58:02 2006
From: sbalneav at legalaid.mb.ca (Scott Balneaves)
Date: Wed, 24 May 2006 14:58:02 -0500
Subject: [Python Wpg] Meeting reminder, Wednesday night
In-Reply-To: <17523.47891.389833.986159@gargle.gargle.HOWL>
References: <17523.47891.389833.986159@gargle.gargle.HOWL>
Message-ID: <20060524195802.GC4557@localdomain>

On Tue, May 23, 2006 at 08:46:59PM -0500, Stuart Williams wrote:

> Don't forget that this month's meeting is Wednesday night with Syd
> presenting on Object Oriented Programming in Python.

My kids have a band concert tonight, so I'm off to the Franco-Manitoban
cultural centre to listen to the dulcet tones of the grade 7, 8 and 9
jazz band do their thing.  I won't be attending, my apologies.

> One agenda item for decision will be what we should do over summer,
> i.e. meet or not, and if so when.  If you do not plan to attend this
> meeting (shame, shame) but would like to weigh in on the decision,
> please email your opinion either to the entire list or to someone such
> as Syd or me who will be attending.

I'm happy to try a meeting or two.  July would be out, but I'd be there
for the June and August meeting!

Cheers!

Scott

-- 
Scott L. Balneaves | "Looking beyond the embers of bridges glowing behind us
Systems Department |  To a glimpse of how green it was on the other side..."
Legal Aid Manitoba |    -- Pink Floyd "High Hopes"


From syd at plug.ca  Wed May 24 17:44:17 2006
From: syd at plug.ca (syd at plug.ca)
Date: Wed, 24 May 2006 16:44:17 -0500 (CDT)
Subject: [Python Wpg] Meeting reminder, Wednesday night
In-Reply-To: <17523.47891.389833.986159@gargle.gargle.HOWL>
References: <17523.47891.389833.986159@gargle.gargle.HOWL>
Message-ID: <63029.142.132.4.215.1148507057.squirrel@mail2.plug.ca>

> Greetings,
>
> Don't forget that this month's meeting is Wednesday night with Syd
> presenting on Object Oriented Programming in Python.
>
> One agenda item for decision will be what we should do over summer,
> i.e. meet or not, and if so when.  If you do not plan to attend this
> meeting (shame, shame) but would like to weigh in on the decision,
> please email your opinion either to the entire list or to someone such
> as Syd or me who will be attending.

Just a reminder that tonight's meeting will be in 2M70 rather than the
room on the mezzanine in the library.

See you there.

Regards,
Syd