[OLPC-Games] KuKu refactor for decreased playtime lag

Julius B. Lucks julius at younglucks.com
Sun Aug 19 17:19:13 EDT 2007


Hey Chris,

I was just looking at your patch.  It looks like you added some  
get_xxx() methods to the classes Lives, Score and Time.  Those  
classes used to be in kuku.py, but in the newest code, I have  
refactored them into widgets.py.  As a result, I couldn't run the  
code with just the patch on kuku.py.  When you make the patch you  
want me to commit, can you add those methods to the classes in  
widgets.py, then add widgets.py and kuku.py, commit, and make the patch?

Alternatively, the reason why I was using score.number instead of  
score.get_score() (and lives.number instead of lives.get_lives(),  
etc.) is to make the widgets code cleaner by not having to write  
accessor methods.  It seems like accessor methods are in general not  
needed so much in python.  Do you think we need them?  If not, I  
think it is much simpler without them.  If you have a compelling  
reason for them, I'd love to know more - I haven't coded a lot with  
others in python, and am still learning what is the 'pythonic' way of  
doing things.

Cheers,

Julius

------------------------------------------------------------------------ 
---------------
Please Reply to My Permanent Address: julius at younglucks.com
http://www.openwetware.org/wiki/User:Julius_B._Lucks
------------------------------------------------------------------------ 
----------------



On Aug 19, 2007, at 12:36 PM, Christopher Schmidt wrote:

> On Sun, Aug 19, 2007 at 10:29:24AM -0400, Julius B. Lucks wrote:
>> Hey Chris,
>>
>> That's awesome!  I have been refactoring some of the backend of kuku,
>> but have not touched the main event loop yet - hence the current
>> version in the main branch of the git repo is out of date of the xo
>> that is on the wiki.  There is a branch called trial-2 in the git
>> repo which contains code that should be very similar to the posted xo
>> file.  You should be able to see it in the cloned repo by doing 'git
>> checkout -b my-trial-2 origin/trial-2'.  (Also see http://
>> wiki.laptop.org/go/Kuku/Git_Usage)
>>
>> The only changes I have done to the main kuku.py file have to do with
>> import statements and pulling out some class definitions due to my
>> module refactoring.  The best way to create a patch would be to do
>> the following with git (sorry if you know this git stuff already).
>
> I don't, thanks. I'm very much new to git (and, obviously, OLPC in
> general), so this is exactly what I was looking for. I did try the  
> 'Git
> with Kuku' wikipage, but my head was swimming within the first bit :)
>
> There's an untested patch attached which I think is pretty close to  
> what
> I want -- If I use the kuku that comes out of the main kuku repo,  
> should
> it work? And if I patch it there, will it be something yo ucan pull  
> back
> into the other code you're writing without problems?
>
>> git clone (kuku repo url)
>> git checkout -b kuku_patch_branch
>> (port your patch to kuku.py)
>> git add kuku.py
>> git commit
>
> git commit gave me a message here:
>
> # Changed but not updated:
> #   (use git-update-index to mark for commit)
> #
>
> so I did:
>
> git-update-index --add kuku.py
>
> then committed.
>
>> git format-patch master..kuku_patch_branch
>>
>> That should create a file called 0001_my-commit-message.patch.  You
>> can send the patch to the list and I'll apply it and check it in.  If
>> you have set your git config variables with your name and email, it
>> will commit it as you when I apply the patch.
>
> I'll play with that later :) For now, I'm just happy to get a patch,
> though don't bother applying the patch attached until I get a  
> chance to
> test it out (since I didn't do any porting, just bunged the code in
> there) -- I'll email the list again when I get there.
>
>> Right now there are no tests for the kuku.py, but there are some for
>> the other modules (like Tile and Grid).
>
> Okay. That's no big deal, just wanted to make sure before I broke  
> tests
> :)
>
>> I'll be on IRC later today (Sunday) around 5 or 6ish sitting in  
>> #olpc-
>> content as jblucks if you want to chat about the patch etc.  Please
>> feel free to keep refactoring away - the next major step will be to
>> add collaboration to kuku which should start with refactoring the
>> State class out of kuku.py.
>
> k. I'm crschmidt there -- I think I'm going to try  to add  
> collaboration
> to Reversi first (since the code feels a bit cleaner/easier to hold in
> my head at the moment) -- hopefully will help me get my bearings. The
> Tubes are slightly... complex to understand to someone who's never
> written anything on the OLPC, or anything using DBUS, or anything  
> not at
> the console. (A browser is my typical GUI -- this whole 'client other
> than the browser' thing is new to me. :))
>
>> And please put your name up on the wiki page as a contributor!
>
> After code gets checked in, I can do that :) For now, I'm just a  
> random
> passerby.
>
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> <0001-adding-kuku.py-i-think.txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/games/attachments/20070819/31e76d42/attachment-0001.htm 


More information about the Games mailing list