Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 426 427 [428] 429 430 ... 796

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

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6405 on: September 26, 2014, 05:11:34 pm »

=& to multiply, anyone?
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6406 on: September 26, 2014, 05:17:08 pm »

I'm going to need your badge and laptop InsanityIncarnate.
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6407 on: September 26, 2014, 05:56:35 pm »

@ for matrix multiplication, anyone?

Oh wait...
Logged

Sergius

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6408 on: September 26, 2014, 11:15:37 pm »

Too bad you can't overload the ternary operator tho, or turn arbitrary operators into ternary (quaternary?).
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6409 on: September 26, 2014, 11:45:42 pm »

I can write some code with no handlebars logic
// quadratic formula
x >> (-b == q(b<<b/4<<a<<c))-(2<<a)
// EDIT: missed a parens
« Last Edit: September 27, 2014, 04:43:09 am by Skyrunner »
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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6410 on: September 26, 2014, 11:51:19 pm »

that is making me cry

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6411 on: September 27, 2014, 01:54:59 am »

Operator overloading: the feature that seems silly right up until you try to write your first vector library in a language without it.

It tends to go along the lines of this:
Code: [Select]
vector A, B, C;
...
// Right then; time to write some code using my vector math!
C = A.Multiply(A.Add(B)).Divide(B);
// Or wait, was that my in-place operation function, or one that returned a modified copy?
C = A.MultiplyCopy(A.AddCopy(B)).DivideCopy(B);
// I really hope I don't have to optimize this; I can barely tell what it's doing now.
...
// Some time later:
C.Multiply(A.MultiplyCopy(A.AddCopy(B)).DivideCopy(B).Subtract(B.AddCopy(C).MultiplyCopy(D)).MultiplyCopy(7.0f));
//  I think I'll just switch to a geography major and drink alcohol until I die
As opposed to
Code: [Select]
C *= (A*(A+B)/B) - ((B+C) * D) * 7.0f;
Which is quite the breath of fresh air when you switch back to a language which trusts you with a bottle of glue, rather than only giving you glue sticks.
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6412 on: September 27, 2014, 03:30:17 am »

For some reason this discussion made me think of this gem:
Code: [Select]
/proc/random_frequency()
    return 1337 //WHY -Doohl

Even though there are easy, built-in ways to get random numbers...
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.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6413 on: September 27, 2014, 04:53:23 am »

Spoiler: Obligatory xkcd (click to show/hide)
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6414 on: September 29, 2014, 09:02:46 am »

So I'm having an... interesting problem with Unity.

I have 2 scripts (script A and script B) attached to one GameObject, both scripts have a "OnTriggerEnter2D" callback. one script (script A) starts a co-routine that yields null and destroys itself (so it destroys itself the frame after being triggered).

For some unexplainable reason, about 2% of the time it will not call script B's OnTriggerEnter2D function for no apparent reason. it *should* trigger both of them (and it shouldn't matter what order, since I am destroying it *next* frame), but its not.

Adding in extra yields fixes the problem (I think), but then the object remains on the screen for a noticable time after being triggered.

From debugging, when script A is triggered, the destruction takes place the next frame 100% of the time (including when script B is not triggered).

I... have absolutely no idea what is going on here. Is there some simple logic thing I have missed or something?
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6415 on: September 29, 2014, 09:43:55 am »

It *sounds* like a race condition, so maybe the order of the scripts running isn't guaranteed?

I assume unity has no "destroy at end of frame" concept.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6416 on: September 29, 2014, 09:48:09 am »

I *thought* it could have been some sort of race condition, thats why it yields and destroys itself next frame (to allow it to finish calling everything).

It also turns out that adding another yield did *not* actually fix the problem, so the callback sometimes isn't called even though its being destroyed 2 frames later.

This is an infuriating bug, there is only so many times you can jump into a fireball (with like a 2% chance to actually see the bug) before you go insane.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6417 on: September 30, 2014, 01:57:49 am »

So, in my Operating Systems class, I'm having to build my own shell in C.

Never did I think it would be so difficult to create a ragged string array on the fly. Nor make getchar() play nice.

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6418 on: October 01, 2014, 02:45:31 pm »

Picking up a new language in my Software Languages class, Unicon. It's the professor's baby language but it's pretty nice to use :o

A pain in the ass to compile from source on a Linux distro but the windows executable's nice and easy to work with.

Kashyyk

  • Bay Watcher
  • One letter short of a wookie
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6419 on: October 01, 2014, 03:52:43 pm »

For someone who's main skill in Programming is in C++, how hard is python to pick up?
Logged
Pages: 1 ... 426 427 [428] 429 430 ... 796