Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 382 383 [384] 385 386 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903529 times)

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5745 on: April 25, 2014, 11:55:06 am »

In other news, this is my new favourite programming language.

I've been hearing a bit about Haxe lately.  Apparently Defenders Quest II is going to be using it. 

I'm not sure how I feel about a programming language that compiles to multiple other languages.  Something just doesn't seem right about that, but I'm not really sure what.   :-\
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5746 on: April 25, 2014, 12:36:03 pm »

PYTHON IS SUPER COOL
Now you have to explain, for the babby nublet that is me.

Dynamic size arrays, and dynamic typing. I would dearly love those in Java or C++.
Dynamic size arrays are wonderful ;_;, I miss them so much in languages without them.

PYTHON IS SUPER COOL
Now you have to explain, for the babby nublet that is me.
This should explain all there is to know about Python.
That's more helpful. What's an array?
An array is programmer-speak for what you probably know as a list. It's a variable that contains a number of other variables (that are usually accesed by array[index])
« Last Edit: April 25, 2014, 12:51:11 pm by miauw62 »
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5747 on: April 25, 2014, 04:17:36 pm »

PYTHON IS SUPER COOL
Now you have to explain, for the babby nublet that is me.
This should explain all there is to know about Python.
That's more helpful. What's an array?
An array is a type of non-sparse (no gaps in it) container that keeps its contents in a strict ordering (if you put an item into the first index, it will be the first one you see if you later loop over the container). They're indexed by a number, and every number up to its size contains an element. In most programming languages they're kept in a contiguous piece of memory, which makes them VERY fast.

Depending on the language and various details, an array can either have a fixed or dynamic size.

Arrays are always non-sparse, which means there are no gaps. If there's an element at 9, there must be one at 8, 7, 6, etc.
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5748 on: April 25, 2014, 04:50:37 pm »

> Now now, don't blame Perl for your ugly Perl code; it's your own fault if you irresponsibly
> overuse all the shortcuts and extra features Perl has built in to make your life easier.
Lol. Well, my biggest problem with Perl is that when I have a clusterfuck of nested hashes and arrays, I end up finding which combination of sigils work by trial and error. Also, I don't like modularity and classes in Perl. So my scripts end up messy despite my efforts to clean them up. I can see how this is because of my ignorance, but I don't have these kinds of problems in C, C++ and C#.

> If there's an element at 9, there must be one at 8, 7, 6, etc.
Well, technically you can allocate an array of size 10 and don't even use elements 8, 7 and 6, but this has several problems, such as wasting memory and needing another bit array to know which elements to skip in for loops.
Also, lists of comparable types (ones for which you can tell if a < b) can be implemented as balanced trees or skip lists for much faster access (but still slower than arrays), but are usually just lists.

Anyway, as far as speed goes, my rule of thumb is that these operations are slow and should be minimised:
* Talking to a server over web.
* Talking to a Database.
* Disk reads and writes and some other syscalls.
* O(n*n) or slower operations (Includes calling O(n) operations in a loop).
Everything else is usually blazing fast and memory is plentiful, so it's OK not to try and be clever about optimization. This approach is sloppy and lazy, but works.
« Last Edit: April 26, 2014, 02:27:55 am by Maklak »
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5749 on: April 25, 2014, 05:20:31 pm »

In other news, this is my new favourite programming language.

I tried it once. It seems cool, but I remember having some discomfort getting set up, and then I got a bit annoyed that it decided to tell me about an unimplemented function at runtime. I’ll probably give it another try now that you have reminded me.
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5750 on: April 25, 2014, 06:51:59 pm »

* O(n*n) or slower operations (Includes calling O(n) operations in a loop).

Reminds me of some O(n!!) (not a typo) stuff one of my coworkers found.

Everyone who looked at any of the offender's code knew he shouldn't be a programmer. He was gone by the time myself and the group of coworkers I hang out with showed up, so we were left with cleaning up his messes.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5751 on: April 25, 2014, 07:00:49 pm »

* O(n*n) or slower operations (Includes calling O(n) operations in a loop).

Reminds me of some O(n!!) (not a typo) stuff one of my coworkers found.

Everyone who looked at any of the offender's code knew he shouldn't be a programmer. He was gone by the time myself and the group of coworkers I hang out with showed up, so we were left with cleaning up his messes.

He did it by accident? How do you even do that by accident?

(Wait, is that double factorial or factorial factorial? It's the difference between 15 and 6.67*10^198.)
« Last Edit: April 25, 2014, 07:02:38 pm by Putnam »
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5752 on: April 25, 2014, 07:42:35 pm »

* O(n*n) or slower operations (Includes calling O(n) operations in a loop).

Reminds me of some O(n!!) (not a typo) stuff one of my coworkers found.

Everyone who looked at any of the offender's code knew he shouldn't be a programmer. He was gone by the time myself and the group of coworkers I hang out with showed up, so we were left with cleaning up his messes.
(Wait, is that double factorial or factorial factorial? It's the difference between 15 and 6.67*10^198.)

The latter.

Yeah. I have no idea how or why.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5753 on: April 25, 2014, 07:54:58 pm »

> Now now, don't blame Perl for your ugly Perl code; it's your own fault if you irresponsibly
> overuse all the shortcuts and extra features Perl has built in to make your life easier.
Lol. Well, my biggest problem with Perl is that when I have a clusterfuck of nested hashes and arrays, I end up finding which combination of sigils work by trial and error. Also, I don't like modularity and classes in Perl. So my scripts end up messy despite my efforts to clean them up. I can see how this is because of my ignorance, but I don't have these kinds of problems in C, C++ and C#.

Use the pointer notation instead of lots of sigils:
Let's say you have a reference to an array of hashes of hashes. Then you can access one of the deepest elements simply by using $rahh->[$a]->{$b}->{$c} or, even simpler, $rahh->[$a]{$b}{$c}. If you want to grab an entire innermost hash by reference, use $rahh->[$a]->{$b}, and if you need it by value for some reason, write %{$rahh->[$a]->{$b}}.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5754 on: April 25, 2014, 07:55:24 pm »

Quote
(factorial snip)

I can't even do that on purpose...

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5755 on: April 25, 2014, 08:11:23 pm »

Re: Haxe: What's the catch? Semes to good to be true :I
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5756 on: April 25, 2014, 09:35:39 pm »

Quote
(factorial snip)

I can't even do that on purpose...

Yeah, I'm intensely curious what that algorithm did.  It obviously never ran to completion on any problem of any notable size...  I've written some plenty slow things in my time, but I don't think I've ever even accidentally written anything over O(n^4) complexity.

In other news, I think there may be hope for our development team after all.  We've got Linux VMs running on a cloud server in our data center that I've spent a few days replicating the live environments on.  We'll be able to make code and database changes on something other than a live site for the first time...
Logged
Through pain, I find wisdom.

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5757 on: April 26, 2014, 02:05:48 am »

The only possible thing I could think of that could run in factorial factorial time is something that generates all permutations of a set (say a string), does something with it, then generates all permutations of some resulting set.
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5758 on: April 26, 2014, 02:40:58 am »

SS13 has a ton of bad code too. There's two code areas so horrendously bloated that additions are being denied just to keep some sort of hope of ever making it maintainable, and at least one other code area that is so confusing and obtuse that nobody has even tried to touch it.

One of said bloated areas is part of a larger spaghetti network.
A game-breaking bug caused by a missing check for an unused gamemode that allowed handcuffed monkeys to transform humans into monkeys.
A specific and rare role has speshul snowflek checks in insane amounts of code.

Etc, etc, etc.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5759 on: April 26, 2014, 01:02:54 pm »

I won my school's programming contest :D
Pages: 1 ... 382 383 [384] 385 386 ... 796