💾 Archived View for gemini.hitchhiker-linux.org › gemlog › reliant.gmi captured on 2024-06-16 at 12:18:56. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2024-06-20)

-=-=-=-=-=-=-

Reliant

2024-06-15

Coming up on the end of week six of eight in my current term at school and we had to turn in an interim milestone for our final project in my Python course. The assignment was to build a text based adventure game. I thought I'd go a little above and beyond and add in some ascii art, throw in a few Easter eggs and be a nerdy old Trekkie.


    ________________ _     _____      _______________        ________   ___
  ,' ________   ___// \    \  __`-.  /___   ___/\  __`-.   ,' ___/\ /  ,' /
 |  `-.__    | |   / . \   | |,',-'      | |    | |,',-'  | ,'___ | |,',-'
  `-.___ `,  | |  / /_\ \  |  _ `-,      | |    |  _ `-,  |  ___/ |  _ `-,
  ______\  \ | | / _____ \ | | `-. \_    | |    | | `-. \_| `.___ | | `-. \_
 /_________| /_|/_/     \_\|_\   /__/    /_\    |_\   /__/ `.____||_\   /__/

      *          ___---__             +
                '----___'   _-_                  *
               .-----|\-`--'---`---.______                            *
  +            `-`---| \._________.------'                        .
                __.--'  / `--_--'           .
    __________-'-------'___
    \____(============/_=_/

        .            _____        _______      ___     _    __    __   ________
        ;            \ __ `-.   ,' ___/\ |     \ /    / \   \ `.  \ / /__   __/
    - --+- -         | |,',-'  | ,'___ | |     | |  ,' . `. |   \ | |    | |
        !            |  _ `-,  |  ___/ | |     | |  |  |  | | |  `  |    | |
        .            | | `-. \_| `.___ | |___  | |  |  _  | | | `.  |    | |
                     |_\   /__/ `.____||_____\ /_\ ,'_/ \_| |_\   /_\    /_\


'''

The game takes place aboard the Federation starship Reliant during the early part of the movie "The Wrath of Khan", before the arrival of the Enterprise on scene. You are a Junior grade ensign on a spacewalk inspecting hull plating when the ship is compromised. Your best friend, Mike, assigned to hydroponics, is a perpetual slacker who is always dragging you into trouble. You get a message from him on your private encrypted channel about what went down. Where's Mike and how did he survive? Well he and his girlfriend Becky were hiding out in a Jeffries tube near hydroponics smoking a joint during the takeover. So after entering the ship, you have to collect Mike and Becky, sober them up, get weapons and storm the bridge to stop Khan from getting Genesis.

This course is called 'Introduction to Scripting' and they pretty much assumed that we were coming into it with no programming experience. The fact that I'm not that green has made it both easy and hard at the same time. Easy, because I already knew a substantial portion of the material. Annoying due to the format of our online textbook (more on that later), and hard because if I'm not dilligent I get marked down for rather stupid things. My instructor wanted a lot more code comments from me on my early assignments, for instance. My perspective said, 'What part of this brain-dead code is unclear?'. We also had a number of assignments turned in that were just pseudocode. To me, Python kind of *is* pseudocode already, so I rushed a couple of those assignments and lost points on some finer details which to me were obvious and didn't actually need written down.

## Python is exactly what I always thought it was
I've always avoided Python so I've never really learned it before now. I've written a few small one-off things just to say I have, and I experimented with using PyGTK+ and PyQt to add a GUI to an existing program a while back. But for the most part I've done everything I can to just ignore Python before now.

Picking it up was easy enough after having explored a bunch of other languages more in-depth, and on the one hand I can see how quickly a program can be knocked together when you never have to type cast and the syntax seems designed for speed. I see the appeal. I just don't share in it. Python still feels to me like a toy. It's not the syntax, but the fact that it completely glosses over and abstracts away how data is actually stored in memory and accessed by the processor. I get that the whole point of the language is to make programming accessible without having to think like a computer. But I've already trained my brain to think a certain way when coding and I really can't stand giving up the control over how the memory is laid out that has so much bearing on how your code performs.

Even so, I'm glad that I've finally taken some time to learn more about the language. I even found a few syntax features that I really like and kind of wish I could bring over to other languages. I like list comprehensions for instance. I can see that particular syntactic suger being usable in other languages. Basically is just applying a closure to transform a collection. I also like the *args and **kwargs syntax for handling varargs. If you've ever used varargs in C you'll know it's rather clunky, and some languages don't even have this facility or require a macro (Rust). That's not enough to get me on board with using Python anywhere I don't have to of course, but it does illustrate that good ideas can be found everywhere.

### Tags for this page
=> ../tags/StarTrek.gmi StarTrek
=> ../tags/python.gmi python
=> ../tags/programming.gmi programming
=> ../tags/school.gmi school

=> .. Home
=> . All posts

All content for this site is licensed as CC BY-SA.
© 2024 by JeanG3nie
=> finger://hitchhiker-linux.org/nathan Finger
=> mailto:jeang3nie@hitchhiker-linux.org Contact