[Tutor] results not quite 100 percent yet

bhaaluu bhaaluu at gmail.com
Thu Feb 21 12:48:35 CET 2008


On Wed, Feb 20, 2008 at 6:39 PM, Tiger12506 <keridee at jayco.net> wrote:
>
>  I'll throw a couple of thoughts out there since I know that you appreciate
>  to see many points of view.
>
>
>  > #!/usr/bin/python
>
>  Hard-coded. That means you have to change the program to change the game. It
>  would not be difficult to store this/read it in from a file, making the same
>  program suddenly handle an infinite number of games. (well not infinite, but
>  at least 19*7*2147483647)
>

Noted. I'm sure that can be incorporated into a future version.
Also wanted for a future version: SAVE feature, so a game can
be quit in the middle, and not have to be started from scratch
to get back to the same point. HI-SCORES feature shouldn't be
too difficult to implement. etc. etc. etc.

Thanks! 8^D

>
>  > # Distribute the treasure
>  >
>  > # Place androids/aliens in rooms
>
>  Those two block of code above are SO similar that sure they can be combined
>  into one, or at least the first parts of them.
>

Optimization is the LEAST of my worries at this point.
What these routines DO, and DO 100% of the time
(as far as my tests have shown) is:
1. puts a positive integer into the 6th element of 4 lists in the table
2. puts a negative integer into the 6th element of 4 lists in the table
3. neither routine puts an integer where there is not a zero (no overwriting)
4. neither routine puts an integer in list 6 or list 11

100% of the time!
That's what I was looking for, and these routines do the job.

First: get the routine to do exactly what you want it to do.
Second: Readability. I can read and understand these routines.
Third: Maintainabilty: They are easy to maintain! See Second.

I made a test and ran it 10,000 times in a bash shell script.
I got 100% results. Not 97%, 98%, 99%....... but 100%.

If you're interested in my test, ask, and I'll send it.
I used a bash shell script, so I don't know how well the test
will work in MS-Windows:

#!/bin/bash
for i in `seq 1 100` ; do python setupTable.py >> setup.out ; done

The new game has 43 rooms, not 19. These routines have already
been ported to the new game, easily and quickly.

No Zen required!

Other beginning programers shouldn't have any problems using
these routines. Plus, I was able to replace the old (97% reliable)
routines with these routines simply by dropping these into place.
They worked immediately, without a hitch, and I'm not greeted
with treasure or a monster at the Entrance or Exit to the game
(6 & 11 respectively).

100%!!!!!!!! 8^D
I'll certainly keep your suggestions in mind! Thanks!
-- 
b h a a l u u at g m a i l dot c o m
"You assist an evil system most effectively by obeying its
orders and decrees. An evil system never deserves such
allegiance. Allegiance to it means partaking of the evil.
A good person will resist an evil system with his or her
whole soul." [Mahatma Gandhi]


More information about the Tutor mailing list