[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [haggis] Base perl game code
On Thu, 1 Jul 2004, Mark Ballinger wrote:
> On Thu, Jul 01, 2004 at 10:06:50AM -0600, John Williams wrote:
> >
> > And unless someone objects, I'm going to try to refactor the common code
> > out of some of the perl games on the server. If I can get my laptop
> > working, I could have some refactored code running in a week or so.
>
> Hi everybody. I have actually been granted a full day tomorrow
> (Friday, July 2) to do nothing but goof off on the laptop.
>
> Sharkey: one thing I'm hoping to do is what you're saying here. I
> kept a base generic perl game when I stripped out all of the werewolfy
> code to build haggis, but I think it can be taken down further. I can
> send you my first "version" of haggis, which is pretty basic, but
> since then I've made a bunch of changes that could probably be written
> back to werewolf and even risque.
>
> I know nothing about perl modules and code reuse, but that should be
> the ultimate goal. I'll need your help on that.
It's not too difficult, but you have to get used to using more hashrefs
and arrayrefs instead of hashes and arrays. And putting $self-> in front
of a lot of things.
So far I've stripped most of the haggis out of a file and put the rest of
it in a perlgame.pm file. Now I'm going thru werewolf.pl and stripping
out the stuff in perlgame.pm, refactoring a bit more as needed. I'm about
half way thru that. I thought I would do werewolf first because it is not
changing as much as haggis.
I'll send you the files for comment as soon as I get werewolf running.
(Fedora Core 1 installed easily, so the laptop should be good enough for a
weekend coding spree.)
~ John Williams