Programming

Discussion in 'General Chatter' started by Morven, Feb 26, 2015.

  1. Morven

    Morven In darkness be the sound and light

    I suspect I might be the same; I like Ruby in the contexts I've used it now, but never tried Rails and it doesn't sound what I want.
     
  2. Exohedron

    Exohedron Doesn't like words

    It's, well, railroading, for lack of a better word. Everything it does I keep thinking "there must be a better way to do this, but Rails doesn't let me do anything else". Maybe it's been optimized. But it's just so much crap I have to install and configure and adjust before I can even start testing even the tiniest bit of code, and of course none of the error messages are useful and the guides just assume everything works right out of the box. Hah.
     
  3. liminal

    liminal I'm gonna make it through this year if it kills me

    Well, I am going to get into programming when I have more spoons for it. Right now I'm a bio major. My whole life people told me "your bad at math" so I just assumed that I'd be terrible at anything computer related because I assumed it' be pretty math heavy and machines never really interested me. I was watching videos of various computer viruses and I was like "huh, so it's like how actual viruses work" and I've gradually built up some interest in computers because I use them all the time, and basically the only things I know about them I've learned through trial and error. I might as well start learning to get a better understanding of the tech I use all the time. As it turns out it's not nearly as math heavy as I thought and oh yeah, I'm actually not that bad at math either*

    the only thing even remotely related to coding I've done was I used to edit layouts and stuff on neopets as a hobby (I liked getting ratings!). But then after awhile the culture shifted and no matter how much time I spent editing people would still rate it a 0/10 because I edited a premade instead of making it from scratch. Which really pissed me off since it was kinda impossible for me to do, since all I've ever done was work with what someone else already wrote. I knew how to edit stuff to look like what I wanted when the code was right in front of me (with a little bit of trial and error), but my brain had no idea how to summon the information out of my brain while looking at a blank box. Sooooo I edited a premade beyond all recognition and people gave me good ratings again lol.

    I mean, I could absolutely suck at programming, but it's something I want to try at least. I feel like whatever knowledge I would gain would be worth it.

    *except the math involved in chemistry, because it sticks in my brain like an under cooked noodle thrown at a wall (NOT AT ALL)
     
  4. Exohedron

    Exohedron Doesn't like words

    So guess who just found out the hard way that Windows is incompatible with seriously developing in Rails? Me! It turns out that large, important portions of the Rails library are not supported on Windows machines at all, and, being Rails, are very hard to replace with other libraries.
    So now I get to try to figure out if I want to install a virtual machine or switch to a different aspect of the project. Fortunately it's volunteer work so I'm under no obligation to do anything in particular, but I was pretty invested in the app up until I tried testing my most recent batch of code.
     
  5. Morven

    Morven In darkness be the sound and light

    Installing virtualbox and a Linux is really simple, though. And free.
     
  6. Exohedron

    Exohedron Doesn't like words

    It's not that it's hard to deal with. It's just one in a long list of irritations that Rails has thrown at me.
     
  7. albedo

    albedo metasperg

    Ugh. FINALLY finished up a very annoying project.

    We're switching from a Unix-based word processor to its Windows-based version. This will mean we don't have to maintain Solaris VMs anymore, which is nice from a technical perspective. However... Since we've been on the Unix program for thirty years, there's a tangle of nasty custom code built on top of it.

    It's BAD code. It was written by people who literally didn't know what a variable was - they used global variables or none at all.

    It's in at least three different languages - a proprietary language specific to this program, CShell, and a bastardized Lisp version with crippled I/O. This was not for good reasons, but because whenever a new developer came on, they didn't bother to understand the old code.

    And some of it won't work on the Windows side, because it uses features that weren't ported from Unix->Windows.

    So I've spent the last few months converting the incompatible code, and testing the remaining nonsense to make sure it'll still work. =_= We want to completely burn down and rewrite this crappy code, but we won't have time to do so before the word processor switch. Particularly because we're going to need to get the end-users heavily involved in order to determine what this horrible code was actually supposed to do. A lot of it's just been wrong for the last thirty years, and it's a black box that everyone's afraid to touch.

    Finally. FINALLY. I have everything converted, and I've tested all the expected problem spots. I need to do a little more minor testing, just to make sure I don't have any stupid typos, and all of the required templates and stuff are in place.

    But I'm DONE.

    I'm going to go play with something completely different.
     
    • Like x 1
  8. chaoticArbiter

    chaoticArbiter an actual shiny eevee (destroyer of worlds)

    A PROGRAMMING THREAD
    hi
    I know Java, C++, C#, Python, and I'm attempting to learn Ruby
    hi friends
     
  9. Wiwaxia

    Wiwaxia problematic taxon

    Heyo, can I ask you fine codewranglers for a bit of advice on the Python encounter generator program I'm cobbling together for my SBURB game?

    First question: how do I share what I've got so far? Just copy it up here as plaintext, or?
     
  10. Morven

    Morven In darkness be the sound and light

    @albedo: Unix-based word processor? Has to be Framemaker. That's something I didn't think people did anymore.
     
  11. albedo

    albedo metasperg

    @chaoticArbiter Hi. :D

    @Wiwaxia That probably works, if it's not crazy-long. Otherwise, you can probably upload it in TXT format.

    Even older, painfully; it's QuickSilver. https://en.wikipedia.org/wiki/Interleaf

    Apparently in the early nineties, it was the only word processor that could handle several-thousand-page documents. And then we were trapped.
     
  12. seebs

    seebs Benevolent Dictator

    I'd probably use github or something similar.
     
    • Like x 1
  13. albedo

    albedo metasperg

    Yeah, that's what I'd usually advise; learning git is just kinda confusing at first, and you can only cram so much new data into your brain at once.

    @Wiwaxia When you've got the mental bandwidth available, source control is a really good idea, though. It keeps old versions of your code, like a wiki's "history" tab. Very useful when you mess up and need to revert, or when you need to see what you were doing when.
     
  14. Wiwaxia

    Wiwaxia problematic taxon

    source control? I'm not familiar with the concept.
     
  15. albedo

    albedo metasperg

    https://en.wikipedia.org/wiki/Version_control

    Source control is software which stores all the old versions of your code. Git is a common one, and pretty good.
     
  16. Wiwaxia

    Wiwaxia problematic taxon

  17. Wiwaxia

    Wiwaxia problematic taxon

    oop, should probably ping @albedo there
     
  18. ADigitalMagician

    ADigitalMagician The Ranty Tranny

    Like so.

    So, just putting note for "All the Pep 8 complaints" because I am a Pep8 fangirl.

    Continuing on while I read this:

    What exactly are you needing help with in this case?

    IE: Use case/example of what should happen/what kind of advice you'd like.

    Also, feel free to ping me on Skype since yes. I can help with the Python.
     
  19. Wiwaxia

    Wiwaxia problematic taxon

    Right. So right now it's main() that i want to work on, although i might split what needs done out into more functions. Except for some more tuning-up shit the rest of the generator does just fine at spitting out an Underling of a given type and grist, but I want to add something where you can either give it a type of underling, a number and a Land and it spits out that many underlings of grist types appropriate to that land, or you give it a land and a number and it gives you a bunch of underlings of appropriate grist types whose levels sum to that number.

    I have an excel table of lands and the types of underling on them like so
    upload_2016-2-3_16-32-8.png

    (where the first column for each land column is the name of the underling, the second is the type of underling and the third is the type or types of grist it drops)

    And I want to know how put such a table in python so that the program can look up the possible grist types for a given underling and land, preferably without the stupid clunky list-and-endless-if/elif shit I've got going on with the prototypings or grist, so it's easier for someone who wants to to edit the lands and types of grist for their own SBURB session. I'd also like to split the grist and prototyping lists and effects out for easier editing by someone else, too, but i'd like to get the encounter generator bit up and running first.

    Also, Pep 8?
     
  20. ADigitalMagician

    ADigitalMagician The Ranty Tranny

    Python Enhancement Proposals are the basic community discussion on what to add (or remove) from Python. Two famous/important ones are PEP8 and PEP20.

    PEP20 is better known as the Zen of Python (Use your interpreter,
    Code:
    import this
    ).

    PEP8 is the Python Style Guide, mostly a set of best practices on formatting your code. Not actually a thing to worry about unless you're up for cleaning up code. (I have some suggests for that as well.)

    As for your table, you can use either a multidimensional array (similar to your existing table) or a map of maps.

    My default advice would be to do two things:

    Put your data into a CSV style format `land;underling name;underling type;grist,list`. You can actually do this using excel or something (It's an export option!) you just need to fix the format of the data.

    Then you can use that CSV file to pull into your program, and write a function to go through each line of that input file and effectively build a dictionary of dictionaries.

    IE:

    Code:
    encounter_table = {} # should probably be a defaultDict(dict) but only for simplicity.
    with open("input.csv", 'r') as input_file:
        for line in input_file:
           land, underling_name, underling_type, grist = line.split(";")
           try:
               encounter_table[land][underling_name] = {'type': underling_type, 'grist': grist.split(',')}
           except KeyError: # I might be misremembering the error this raises, basically if encounter_table[land] isn't a dict, it'll spit out an error you need to catch
               encounter_table[land] = {underling_name: {'type': underling_type, 'grist': grist.split(',')}}
    
    So this snippet will basically give you a map that is easy to look up later: encounter_table[land][underling_name] will return the dictionary with the type and the grist for easy usage.

    Is this helpful/too much/too little?
     
    • Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice