Author Topic: Programming Megathread  (Read 106400 times)

you forgot brainforget interpreter scripting format
^
Also i actually have brainforget and befunge interpreters installed on both of my laptop and computer

who the forget calls brainforget "brainforget interpreter scripting format"
unless i misunderstood that post

for anyone that didn't know, the humble bundle has a book bundle with a bunch of programming books here


i'm not too sure on exactly what these books offer (since i haven't bought it myself. i'll probably just pay a dollar, though), but it seems like an introduction to the language they're presenting/a bunch of good exercises.

for anyone that didn't know, the humble bundle has a book bundle with a bunch of programming books here


i'm not too sure on exactly what these books offer (since i haven't bought it myself. i'll probably just pay a dollar, though), but it seems like an introduction to the language they're presenting/a bunch of good exercises.
Some nice books I've read before on there like the Erlang and Clojure ones. Definitely worth $15 at least.



just finished python yay

Congrats
Now go read the Python Documentation for the latest version of the language and you might be able to learn more
Then check this out for  a stuffton of python modules (or packages, i forgot which name they use)
https://pypi.python.org/pypi


just finished python yay
if codecademy still teaches python 2, read this and start using python 3 instead

edit: you can tell which one it teaches you by whether it tells you to use print "whatever" (2) or print("whatever") (3)
« Last Edit: August 23, 2016, 06:50:32 AM by Foxscotch »

Wait, print works without parentheses in python 2? Does it work that way for all function? Either way it's dumb.

Wait, print works without parentheses in python 2? Does it work that way for all function? Either way it's dumb.
no, just print. before python 3, print was part of the language's syntax. that's the case in a lot of languages, so I don't think it's really something to be surprised about

Since I'm such a forget up and need 2 math classes and 2 internships I'm taking another year of classes and I'm actually excited about the computer science classes I got. 

I'm gonna be taking a class dealing with game development and it's gonna be using unity.  Now I know this won't get me super deep into anything but it's also a graduate course so it should be a bit deeper than the average course I've taken.  The professor is also a hard ass and I'm worried what he'll think about me because I had an ethics class with him before and everything I handed in was a week late.

The other class I'm taking is natural language processing which is another graduate course.  That one sounds like it might be a bit intense but I'm excited to be doing something cool like that. 

do any of you guys use programmr.com as a learning site also?

So, I'm working with code that a previous intern did on a big platform. Most of our networking stuff is handled by an external plugin called GameSparks (IIRC), which you can go buy and use as well. One of the values provided by GS is a constant called GS_TIMEOUT which is the default connection timeout. Every other script that needs to rely on connecting to something uses the GS_TIMEOUT value so it's all consistent.

I was trying to document some cryptic functionality for the menu builder (don't even get me started on that) and in doing so, I noticed that our main menu times out after 6 seconds, instead of the GS_TIMEOUT value of 20. After traveling through about a million scripts to find the one related to the menu connections, I stumbled across this code snippet:

Code: [Select]
    void Update {

      // Leaving a check here in case GameSparks connection times out.

      float temp = Time.time - startTime;  
      int constraint = 6;
      if ((int) temp == constraint){        
        string retryButton = "Retry";
        PopupSystem.Instance.PopupMessageBox(UT.Lang("GameSparks connection timed out."), retryButton, Restart);

If any of you programmers would like to chime in on why you think this is wrong, I'd love a good laugh right about now.

converting a float to a int?
edit: oh your just comparing the time and seeing if it's above 6 seconds then popping the retry button
should be using GS_TIMEOUT to define it instead
« Last Edit: September 12, 2016, 03:26:34 PM by Metario »

Looks like it's checking if the time elapsed is about 6 seconds. Which is bad, should change it to greater or equal to 6 seconds.

Casting a float to an int is pretty bad, because in C# you have access to the .Floor() and .Ceil() methods, and using equal-to as opposed to checking if it's greater-than-or-equal-to is very stupid, but even then, not using floats for time tracking is pretty bad, especially when Unity's time functions are all floats/doubles. Using a magic number/local variable instead of making a public class property or just using the GS_TIMEOUT const is pretty ignorant.

The one thing I thought of this morning is that it'd actually be better suited to a coroutine/callback method, which are littered ALL over the rest of the code and so I'm not quite sure why chose to handle this in Update(), which is called once per frame, every frame.