As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
We're funding a new Acquisitions Incorporated series on Kickstarter right now! Check it out at https://www.kickstarter.com/projects/pennyarcade/acquisitions-incorporated-the-series-2

[Programming] Page overflow to new thread

12223252728101

Posts

  • DehumanizedDehumanized Registered User regular
    *looks at it for 5 minutes* yup, that's game code

  • bowenbowen How you doin'? Registered User regular
    Yeah if you've ever taken a look at source code for a game almost none of this is surprising.

    Quake's source code was horrific.

    This is "I need to finish this part and I will fucking brute force it if I need to, who gives a shit about elegance if I can't make money?"

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • EchoEcho ski-bap ba-dapModerator mod
    "I'll refactor in the next iteration!" - Famous last words

    OrcaSporkAndrewDrovekdoomybearInfidelzerzhulgavindelCampyDisruptedCapitalist
  • LuvTheMonkeyLuvTheMonkey High Sierra Serenade Registered User regular
    bowen wrote: »
    Quake's source code was horrific.

    Fast Inverse Square Root is beautiful and I will brook no disagreement.

    Molten variables hiss and roar. On my mind-forge, I hammer them into the greatsword Epistemology. Many are my foes this night.
    STEAM | GW2: Thalys
    schussDrovekdoomybearInfidel
  • bowenbowen How you doin'? Registered User regular
    bowen wrote: »
    Quake's source code was horrific.

    Fast Inverse Square Root is beautiful and I will brook no disagreement.

    Literally the best part about the code. So magnificent and simple.

    Everything else looks like horse vomit.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
    LuvTheMonkey
  • NaphtaliNaphtali Hazy + Flow SeaRegistered User regular
    bowen wrote: »
    bowen wrote: »
    Quake's source code was horrific.

    Fast Inverse Square Root is beautiful and I will brook no disagreement.

    Literally the best part about the code. So magnificent and simple.

    Everything else looks like horse vomit.

    Just like the graphics

    Steam | Nintendo ID: Naphtali | Wish List
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    Christ.

    We don't have a clean release branch anymore in our repo. Again.

    I think it's time to take the keys away from kids.

    crimsoncoyoteschuss
  • bowenbowen How you doin'? Registered User regular
    edited January 2020
    wrong thread

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • SpawnbrokerSpawnbroker Registered User regular
    Attempting to get my company to adopt a CI/CD pipeline and getting a lot of resistance. A LOT of resistance. Ugh. I hate this, can't wait to find a new job. Hopefully at a company that cares about good engineering practices.

    Steam: Spawnbroker
    mightyjongyo
  • urahonkyurahonky Registered User regular
    Yeah I'm a contractor on a commercial product and currently we're down to a single Sr developer that is actually working within the company. The issue is that we don't have a CI/CD pipeline and I can't do any of the builds or deploys from where I am.... And this developer goes on vacation on Friday for 2 full weeks.

  • mightyjongyomightyjongyo Sour Crrm East Bay, CaliforniaRegistered User regular
    Attempting to get my company to adopt a CI/CD pipeline and getting a lot of resistance. A LOT of resistance. Ugh. I hate this, can't wait to find a new job. Hopefully at a company that cares about good engineering practices.

    Yeah I tried to push it for the project I'm on right now and the response was "Well, we can do it later after our first deadline, for now we'll have the release group do manual builds"

    You fools! Once you release without it it's too late! You're missing the whole point!

    But, I'm tired of fighting it, so I'm just gonna ride it until something better crops up.

  • AngelHedgieAngelHedgie Registered User regular
    Our build pipeline here is built on GitHub/Open Source Jenkins/UrbanCode Deploy with JIRA and ServiceNow integration to make sure people don't break things. It's nice (if tedious) to do a quick deployment to the lower test environments by just following the chain.

    XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
    Spawnbroker
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Anybody ever interviewed for a technical lead position at Amazon? A recruiter messaged me out of the blue and if nothing else it would be good practice. What kinds of things are they looking for?

  • SpawnbrokerSpawnbroker Registered User regular
    Orca wrote: »
    Anybody ever interviewed for a technical lead position at Amazon? A recruiter messaged me out of the blue and if nothing else it would be good practice. What kinds of things are they looking for?

    I did, about 6 months ago. Almost got it, too!

    Amazon hot tips:
    • Those 14 leadership principles they have on their website and they tell you to study? They actually mean it. Everyone here has drunk the Kool-Aid, and you'd better drink it too! Half of each interview is devoted to "soft skills" questions, and you'd better tie in your answers to at least one LP on every answer you give. This one is tough, I recommend going through the 10 most common interview questions HR managers ask ("Tell me about your most recent project") and answer it in an Amazon-y way.
    • At least one interview will be ball-bustingly hard. This is the bar raiser, it doesn't mean you're doing poorly. Mine was actually a soft skills bar raiser and he deep-dived my resume. He did that thing where every answer I gave led to another question, so "tell me about your deployment process" ended up in a 20 minute deep rabbit hole of how exactly Jenkins was configured.
    • Most of the technical questions are pretty fair, normal problems compared to other Big N companies. What I mean is...you're gonna get graph problems, but they're usually of the flavor "Get me a list of all products that friends in your network have purchased the most of". Data crunching problems. "Given data in X format, filter it again and sort it in a different way and return it in Y format." Problems you could actually see happening at an e-commerce company.
    • System design! There's going to be at least one interview like this, probably more. Mine was to design a video player website, with specific focus on what happens when the user clicks play, pause, buffering, etc.
    • Study up on the normal stuff. Linked Lists, Queues, Stacks, Heaps, Trees, Graphs, Arrays/Strings, the normal gamut for a company of this size. The questions will be slightly easier than what you'd get at Google, because half of the interviewer's time is taken up by leadership principle questions.

    In general I had a good experience with it, even if I didn't get the job. I know I got incredibly close, but ultimately didn't make the cut for whatever reason.

    Steam: Spawnbroker
    OrcakimeAim
  • EchoEcho ski-bap ba-dapModerator mod
    So it's been however many months since I inherited this service, and I only just now realized that this "FooDelayMin int" field in a struct means "delay, minutes", not "delay, minimum".

    I am super not a fan of having minutes as ints. Give me base SI units (ie, seconds) or a proper time.Time field.

    Also document the damn thing.

  • zeenyzeeny Registered User regular
    The fuck. Thje person that wrote this didn't know what's in the time package or something.

  • schussschuss Registered User regular
    Also, Amazon loves endlessly nested modular classes, if their APIs and dev patterns are any indication. Also not adopting CI/CD? WTF?

  • EchoEcho ski-bap ba-dapModerator mod
    schuss wrote: »
    Also, Amazon loves endlessly nested modular classes, if their APIs and dev patterns are any indication. Also not adopting CI/CD? WTF?

    The interfaces in their Go SDK are hilarious. Just one big blob with 300 signatures in one interface for S3 or whatever random service it was I looked at.

    Their recommendation for testing is "yeah, just make your own interface with the shit you're actually using and mock that."

  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    I wouldn't read too much into the AWS SDK...

    The problem is that all the AWS SDKs are super thin wrappers around the same ancient spaghetti-esque Rest API. The SDK doesn't really do much to help actually use it.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
    Dehumanized
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    edited January 2020
    Thinking about it further and looking at the salaries on Levels.fyi, even if I get the job I'm not sure I'll jump ship. But it's still good to stay in practice.

    Reasons why not to jump ship: a huge chunk of the awards are in stock, which is volatile and will follow the market, their vesting dates mean it's all backloaded besides (for the level 5 position I almost took instead of the job I'm currently at they quoted it as being something like 5%, 15%, 25%, 45%), they've got less vacation and company holidays than where I'm at right now, and a worse 401K plan and significantly worse benefits. I'm about 10 years behind where I need to be for retirement and furiously trying to catch up, so that matters to me. The work life balance is famously awful, though it's going to depend on the team...it's probably telling that a coworker who came from Amazon (on a different team than I'll be interviewing at) left after a year. On the other hand I have a friend who's been with them 3 years now I think? Then there's disagreeing with how their business practices in some spaces. Of course, my current company I have the same sets of concerns so I guess that's a wash. Edit: oh yes, they rely on the stock for the "bonus", except their stock has been flat over the last 18 months and I expect a contraction at some point so...

    Reasons to jump ship: completely different problem space and a formal lead role (as opposed to the ad-hoc lead role I've taken on in the past), so it's good career growth and a good opportunity to find new work friends/widen my personal network. Amazon tends towards smaller teams which I prefer--though they tend to overindex there which leads to the work/life balance problem.

    So we'll see. I'll give it my best shot and have no real expectations here, which is probably the best head-space to be in honestly. It's kind of freeing to not really give a shit one way or another. :)

    Thanks Spawnbroker for detailing everything!

    Orca on
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    I'm also mightily amused by their leadership principles because the company I was at for years exemplified almost all of them. I guess they drink the kool-aid because they're trying to force the small company mentality despite being enormous.

  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Small company mentality is "hot" right now. After all, everyone loves start-ups, right! So hot, so hip! How do you do, fellow kids?

    Angels, innovations, and the hubris of tiny things: my book now free on Royal Road! Seraphim
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited January 2020
    My first job out of college was at a startup. It lasted 9 months and then they ran out of money and just didn't send folks paychecks.

    In case you are not yet aware, that's just super illegal.

    They did make me whole several months later, but that scared me off small shops. When I was looking for a new job I was mostly focused on a place that would be around long enough for me to gain some experience. I ended up with a great position at GiantMegaCorp and I've been here for 6 years now.

    Big places like this have serious disadvantages, but at least I know if I lose this job it will probably be my own fault.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • dporowskidporowski Registered User regular
    My experience with startups, compared with my experience at megacorps, has led me to conclude, rather authoritatively, that I much prefer being paid and bonused primarily in "money", which is spendable on things like "food", than in "stock options", which aren't even convertible to lavatory paper.

    admanbOrcaMvrckLD50AngelHedgiebowenkime
  • EchoEcho ski-bap ba-dapModerator mod
    Yeah, I got some stock options, but that's entirely a bonus on top of actual salary for sticking with the company.

    crimsoncoyote
  • DrascinDrascin Registered User regular
    Small dumb Android question from someone who is completely new to the language. How do I force several iterations of a loop to be done sequentailly and wait a bit? Basically, for class I have to make a simplistic Simon game, with the four colored buttons, which need to ping in order to show the sequence to the user.

    So I have a function to ping a button that gets called on the button click listener as well:
    public void pingButton(final View btn, int delayTime){
    
            btn.getBackground().setAlpha(40);
            makeButtonNoise(btn);
    
            final Runnable restoreButton = new Runnable() {
                @Override
                public void run() {
                    btn.getBackground().setAlpha(255);
                }
            };
            handler.postDelayed(restoreButton, delayTime);
        }
    

    Which basically lights up a button, makes noise, then uses postDelayed to wait delayTime milliseconds to un-light the button so the user can identify it. And then to show the sequence (which is created randomly on start) I started simply doing a foreach loop on the sequence:
    public void showSimonSequence(){
    
            for (Integer n:moves) {
                switch (n){
                    case 1: pingButton(upLeft, currentspeed);
                        break;
                    case 2: pingButton(upRight, currentspeed);
                        break;
                    case 3: pingButton(downLeft, currentspeed);
                        break;
                    case 4: pingButton(downRight, currentspeed);
                        break;
                }
            }
        }
    

    But the thing is, it turns out these waits are asynchronous, and the application just pings all the sequence immediately at the same time, lighting up all buttons simultaneously and returning them later. So clearly just doing a loop isn't the way here, because it seems to just multithread this automatically. So how do I force this to do stuff squentially instead of parallelizing it?

    Steam ID: Right here.
  • AiouaAioua Ora Occidens Ora OptimaRegistered User regular
    can you put the wait after your switch statement but inside the for?

    life's a game that you're bound to lose / like using a hammer to pound in screws
    fuck up once and you break your thumb / if you're happy at all then you're god damn dumb
    that's right we're on a fucked up cruise / God is dead but at least we have booze
    bad things happen, no one knows why / the sun burns out and everyone dies
  • crimsoncoyotecrimsoncoyote Registered User regular
    Yeah I much prefer it since we went private, because all my bonuses are in cash, and they don't have stock to give (though technically our first year private they gave stock options for some reason; I think they were trying to turn around and sell quickly, but that never happened).

  • DrascinDrascin Registered User regular
    Aioua wrote: »
    can you put the wait after your switch statement but inside the for?

    Not easily, because it's not actually a "wait" command, it's more of an asynchronous "execute this after X time" kind of thing? And I'm trying to use a Semaphore to do mutex to make the next one wait until restoreButton is done, but it just locks up instead.

    Steam ID: Right here.
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    RSU stock grants of publicly traded stocks are the light anything less (options, private stocks) are terrible

    Orca
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Drascin wrote: »
    Aioua wrote: »
    can you put the wait after your switch statement but inside the for?

    Not easily, because it's not actually a "wait" command, it's more of an asynchronous "execute this after X time" kind of thing? And I'm trying to use a Semaphore to do mutex to make the next one wait until restoreButton is done, but it just locks up instead.

    It's bad design but the easiest way to get where you want to go would be to split the light up and unlight button into two separate asynchronous functions, then schedule them all with appropriate delays at once

  • DrascinDrascin Registered User regular
    edited January 2020
    Phyphor wrote: »
    Drascin wrote: »
    Aioua wrote: »
    can you put the wait after your switch statement but inside the for?

    Not easily, because it's not actually a "wait" command, it's more of an asynchronous "execute this after X time" kind of thing? And I'm trying to use a Semaphore to do mutex to make the next one wait until restoreButton is done, but it just locks up instead.

    It's bad design but the easiest way to get where you want to go would be to split the light up and unlight button into two separate asynchronous functions, then schedule them all with appropriate delays at once

    ...that could be feasible, but boy that is going to look like a mess, seeing how to delay a task it needs to be a Runnable with no parameters, so passing delay times and specific buttons in are going to need to be doe with finals and crap, and a bunch of runnable wrappers are going to be required.

    Drascin on
    Steam ID: Right here.
  • InfidelInfidel Heretic Registered User regular
    You do a queue and write a function that checks the queue, fires off the light on, light off async schedule, the light off calling the first function again. So it chains and repeats until the queue is empty and you don’t schedule any more calls.

    OrokosPA.png
    Drascin
  • DrascinDrascin Registered User regular
    Infidel wrote: »
    You do a queue and write a function that checks the queue, fires off the light on, light off async schedule, the light off calling the first function again. So it chains and repeats until the queue is empty and you don’t schedule any more calls.

    Hmmmm... yeah, I think that might be workable, and make less of a mess. When I get back I'll give that a shot. Thanks!

    Steam ID: Right here.
  • Vrtra TheoryVrtra Theory Registered User regular
    I think there are some workable ideas above, but in my opinion they are more application-driven. Games get very complicated very quickly (lots of things happen that aren't in direct response to user inputs).

    I'd suggest looking into traditional game loops for Android - the update/render loop per frame. In this case you just need some state tracking - in the update loop of each frame you'll check if there is a currentSimonAnimation, and that animation will have key frames set at creation time (so, the decision of turning on and off each light will be simple comparisons between game.currentFrame and a series of on/off frames in the future, set when you instantiate that particular Simon animation).

    In a game loop you don't want to be messing around with all that Runnable stuff.

    Are you a Software Engineer living in Seattle? HBO is hiring, message me.
  • vamenvamen Registered User regular
    edited January 2020
    Can someone clear up some general programming logic for me. I'm going through this Python for Machine Learning course. It's a double-whammy since i don't know any Python OR ML.
    I'm in this Python portion where I needed to write a function to test a string and if it has more than 3 English characters, return true, if not return false. And it works fine, but when I initially wrote it, it always returned false and I realized it's because I had nested (I think is the term) too deep.
    So the working one is:
    uql1c97hn1rv.jpg

    But my original code was:
    yodj20ye1659.jpg

    And I just don't quite understand why it returns both true in that case. I would have thought it would have worked the same.

    Thanks!

    vamen on
  • crimsoncoyotecrimsoncoyote Registered User regular
    edited January 2020
    Your if/else when indented like that is inside the for loop, so it will return True on the first loop iteration

    crimsoncoyote on
    InfidelvamenCampyiTunesIsEvil
  • LD50LD50 Registered User regular
    vamen wrote: »
    Can someone clear up some general programming logic for me. I'm going through this Python for Machine Learning course. It's a double-whammy since i don't know any Python OR ML.
    I'm in this Python portion where I needed to write a function to test a string and if it has more than 3 English characters, return true, if not return false. And it works fine, but when I initially wrote it, it always returned false and I realized it's because I had nested (I think is the term) too deep.
    So the working one is:
    uql1c97hn1rv.jpg

    But my original code was:
    yodj20ye1659.jpg

    And I just don't quite understand why it returns both true in that case. I would have thought it would have worked the same.

    Thanks!

    This is because the indentation is what determines scope in python. In the first example, only the first if statement is a part of the loop, in the second, both are.

    In the lower case, it will always return true because non_ascii starts as 0, is potentially incremented by 1 once, and then will allways be less than 3 for the second if statement.

    crimsoncoyoteInfidelvameniTunesIsEvil
  • vamenvamen Registered User regular
    edited January 2020
    Ahh ha, that makes sense. Thanks guys! Much appreciated, as always.
    I get stuck on the smallest stuff sometimes. I nearly broke my brain trying to figure out some code yesterday because I forgot how dictionaries worked over the weekend and I was treating it like a list.
    I figure it will all click one day =).

    vamen on
    crimsoncoyote
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited January 2020
    Also just a quick note, you should probably use isalpha() possibly in combination depending on if it tries to be clever and accept unicode or not. ord() > 127 only would accept all these as "english characters:" several unprintable characters + all whitespace, tabs, newlines, etc + "1234567890!@#$%^&amp;*()_{}[]:;<>,./?`~\|'-_=+

    The english letter ASCII ranges are 65-90 & 97-122

    Phyphor on
    vamen
This discussion has been closed.