Yep. I learned this from a man with a deep voice and luxurious hair and lots of ferrets. He told me to make my own game, so I'm doing it a little at a time. I'm currently stalled, though.
2 weeks ago
Anonymous
>Thor(PirateSoftware)
He's invading your recommendation section as well I see.
2 weeks ago
Anonymous
And yet Toby is a homosexual who makes games that rationalize the protagonist as guilty for defending themselves. What's your point?
2 weeks ago
Anonymous
My point is that successful don't obsess over trivial details that don't matter when your software will be run on hyper-optimized microchips, they just make good stuff.
2 weeks ago
Anonymous
That Toby cries all the way to the bank when poorgay NEETs pick apart his code for not being le good optimized code.
2 weeks ago
Anonymous
Kys bloodthirsty mutt
2 weeks ago
Anonymous
That doesn't make (You)r code any less shit, anon.
2 weeks ago
Anonymous
Exactly. Look at the source code from all those leaked military weapons years back, I remember seeing caps of various sections and they were also hilariously shit but they got the job done.
Unless you are making a game, physics sim or similar, nobody gives a frick.
Just don't use C++, whatever the frick you do.
That language was a legit mistake and is still a meme, a very unfortunate meme that still persists like Java, a cancer infecting the industry.
C chads run this shit, get microwaved c**ts.
>who cares if end users don't feel the significant performance difference... le written code just bad... it just is ok!!!!!
This is why IQfy codecels will never understand end users enough to achieve fricking year of the linux desktop or build an actual GOOD FOSS shit.
>people still repeating this shit
that code screenshot was shat out by a decompiler. it's not the actual source
2 weeks ago
Anonymous
if it was a decompiler doesn't that mean that whatever people write is just getting compiled into giant if else blocks anyway so it doesn't matter kek
2 weeks ago
Anonymous
>compiled into giant if else blocks
moron there's no if-else in asm.
2 weeks ago
Anonymous
the decompiler has to guess what algorithms were used. No decompiler in existence can take a binary and return good quality C code from it, let alone match the original source.
2 weeks ago
Anonymous
You underestimate the stupidity of many programmers, especially those working on internal programs for businesses. There are numerous examples of live, in-use code that use if-else chains to check for odd numbers, convert strings to numbers and all sorts of other poor uses of conditionals. Python especially is prone to this since it doesn’t have a switch statement, you just use a dictionary of functions instead, which not everyone figures out.
2 weeks ago
Anonymous
I don't underestimate anything moron. I just don't assume that obviously decompiled machine code is any way reflective of the actual source code that produced it.
2 weeks ago
Anonymous
Python isn’t compiled dipshit, at best you’d be “decompiling” Python bytecode. There is only one way to do conditionals in Python, using if else. The more idiomatic way of doing what the OPs function does would be to use a list or dictionary, which would not be converted to COMP_OP operations, but into a single BINARY_SUBSCR operation.
2 weeks ago
Anonymous
>python
dumb frick read the reply chain.
2 weeks ago
Anonymous
If it was the Undertale screenshot, then sure, theres a decent chance it was decompiled. GameMaker has the option to compile its scripts, or the code was otherwise generated from dialogue files or similar. Seems likely actually, given it’s been localised into a few other languages.
It would be more efficient to return the value by indexing a tuple.
def path_order_render(n: int) -> Tuple[int, int]:
return (
(0, 0), # unused filler value
(1, 0),
(1, -1),
(0, -1),
(-1, -1),
(-1, 0),
(-1, 1),
(0, 1)
(1, 1)
)[n]
Is the tuple created each time the function runs, or just once when it's parsed by the interpreter? I'm assuming the latter since the tuple is compile-time constant
It's in the function's set of constants, so it only gets created once when the program is first started.
Is the tuple created each time the function runs, or just once when it's parsed by the interpreter? I'm assuming the latter since the tuple is compile-time constant
def path_order_render(n):
return (n==1 and (1, 0)) or (n==2 and (1, -1)) or (n==3 and (0, -1)) or (n==4 and (-1, -1)) or (n==5 and (-1, 0)) or (n==6 and (-1, 1)) or (n==7 and (0, 1)) or (n==8 and (1, 1))
It would be more efficient to return the value by indexing a tuple.
def path_order_render(n: int) -> Tuple[int, int]:
return (
(0, 0), # unused filler value
(1, 0),
(1, -1),
(0, -1),
(-1, -1),
(-1, 0),
(-1, 1),
(0, 1)
(1, 1)
)[n]
No this is moronic.
What you should do is load the target address and jump
the target address should be computed as a base address + an offset
the offset should be computable from your conditionals
finally the code in the range of valid target adresses should be small enough so the entire thing can be piped into the cache so you dont get a cache miss
You will notice the following advantages:
- The function now works for numbers outside the range 1:9
- The maths is explicit. For scientific uses consider using math.tau.
- Single line of code
- list comprehension is both powerful and beautiful
- Self documenting
I doubt there is anyone here on IQfy that cares enough to even think about trying.
Most people on /g probably don't even know how to write this
doesn't python use elif and not else if
Thanks, haven't used it in a while
Worked for Undertale.
Undertale source leak?
Undertale has every line of dialogue in the game within one giant if statement. It's nested dozens deep.
And yet Toby is a multimillionaire
Yep. I learned this from a man with a deep voice and luxurious hair and lots of ferrets. He told me to make my own game, so I'm doing it a little at a time. I'm currently stalled, though.
>Thor(PirateSoftware)
He's invading your recommendation section as well I see.
And yet Toby is a homosexual who makes games that rationalize the protagonist as guilty for defending themselves. What's your point?
My point is that successful don't obsess over trivial details that don't matter when your software will be run on hyper-optimized microchips, they just make good stuff.
That Toby cries all the way to the bank when poorgay NEETs pick apart his code for not being le good optimized code.
Kys bloodthirsty mutt
That doesn't make (You)r code any less shit, anon.
Exactly. Look at the source code from all those leaked military weapons years back, I remember seeing caps of various sections and they were also hilariously shit but they got the job done.
Unless you are making a game, physics sim or similar, nobody gives a frick.
Just don't use C++, whatever the frick you do.
That language was a legit mistake and is still a meme, a very unfortunate meme that still persists like Java, a cancer infecting the industry.
C chads run this shit, get microwaved c**ts.
May I see it?
No.
>who cares if end users don't feel the significant performance difference... le written code just bad... it just is ok!!!!!
This is why IQfy codecels will never understand end users enough to achieve fricking year of the linux desktop or build an actual GOOD FOSS shit.
>people still repeating this shit
that code screenshot was shat out by a decompiler. it's not the actual source
if it was a decompiler doesn't that mean that whatever people write is just getting compiled into giant if else blocks anyway so it doesn't matter kek
>compiled into giant if else blocks
moron there's no if-else in asm.
the decompiler has to guess what algorithms were used. No decompiler in existence can take a binary and return good quality C code from it, let alone match the original source.
You underestimate the stupidity of many programmers, especially those working on internal programs for businesses. There are numerous examples of live, in-use code that use if-else chains to check for odd numbers, convert strings to numbers and all sorts of other poor uses of conditionals. Python especially is prone to this since it doesn’t have a switch statement, you just use a dictionary of functions instead, which not everyone figures out.
I don't underestimate anything moron. I just don't assume that obviously decompiled machine code is any way reflective of the actual source code that produced it.
Python isn’t compiled dipshit, at best you’d be “decompiling” Python bytecode. There is only one way to do conditionals in Python, using if else. The more idiomatic way of doing what the OPs function does would be to use a list or dictionary, which would not be converted to COMP_OP operations, but into a single BINARY_SUBSCR operation.
>python
dumb frick read the reply chain.
If it was the Undertale screenshot, then sure, theres a decent chance it was decompiled. GameMaker has the option to compile its scripts, or the code was otherwise generated from dialogue files or similar. Seems likely actually, given it’s been localised into a few other languages.
Jest Werked for Undertale
>compiler see the instruction and make a efficient assembly out of it
>zoomers in their 20s making their first python script throw a tantrum
>Python
>Compiler
yes?
It would be more efficient to return the value by indexing a tuple.
def path_order_render(n: int) -> Tuple[int, int]:
return (
(0, 0), # unused filler value
(1, 0),
(1, -1),
(0, -1),
(-1, -1),
(-1, 0),
(-1, 1),
(0, 1)
(1, 1)
)[n]
EDIT: comma after (0, 1).
EDIT 2: Thank you for the reddit gold, kind stranger!
I guess you stopped me. I kneel
Hell yeah, good idea thanks
It would be more efficient to use a switch statement instead of creating an object and discarding 90% of it.
>creating an object
>what is static data
It's in the function's set of constants, so it only gets created once when the program is first started.
Is the tuple created each time the function runs, or just once when it's parsed by the interpreter? I'm assuming the latter since the tuple is compile-time constant
remove (0, 0), put (1, 1) as the 0th element, and AND n by 8
In Rust this is just
fn path_order_render(n: i32) -> (i32, i32) {
[
(0, 0), // unused filler value
(1, 0),
(1, -1),
(0, -1),
(-1, -1),
(-1, 0),
(-1, 1),
(0, 1),
(1, 1),
]
.iter()
.copied()
.nth(n.try_into().unwrap())
.unwrap()
}
Wow, that is terrible. Is this a falseflag?
This is simpler and better in every conceivable way:
fn path_order_render(n: i32) -> (i32, i32) {
match n {
0 => (1, 0),
1 => (1, -1),
2 => (0, -1),
3 => (-1, -1),
4 => (-1, 0),
5 => (-1, 1),
6 => (0, 1),
7 => (1, 1),
_ => panic!(),
}
}
fn path_order_render(n: i32) -> (i32, i32) {
match n {
0 => ( 1, 0),
1 => ( 1,-1),
2 => ( 0,-1),
3 => (-1,-1),
4 => (-1, 0),
5 => (-1, 1),
6 => ( 0, 1),
7 => ( 1, 1),
_ => panic!(),
}
}
Yeah, that's how i would've dome it. Thanks for confirming, anon.
Why can't you just type "return", you homosexuals?
>morons unironically believe that writing spaghetti code will make them millionaires
never change, IQfy
def path_order_render(n):
return (n==1 and (1, 0)) or (n==2 and (1, -1)) or (n==3 and (0, -1)) or (n==4 and (-1, -1)) or (n==5 and (-1, 0)) or (n==6 and (-1, 1)) or (n==7 and (0, 1)) or (n==8 and (1, 1))
Fixed. This is the pythonic way.
What about using a dictionary?
A list is better in this case.
If you change the order you can simply do this.
"""
0 -> (-1, -1)
1 -> (-1, 0)
2 -> (-1, 1)
3 -> (0, -1)
4 -> (0, 0)
5 -> (0, 1)
6 -> (1, -1)
7 -> (1, 0)
8 -> (1, 1)
"""
def path_order_render(n):
return (n//3%3 - 1, n%3 - 1)
from math import sin,cos,pi
def path_order_render(n):
x = -2*pi*(n-1)/8
m = max(abs(cos(x)), abs(sin(x*~~
return round(cos(x)/m), round(sin(x)/m)
Bloat, cos/sine of 45deg is way over 0.5
your mother is bloat
>computing at runtime instead of using a lookup table
Pyjeets, not even once, and thats with their molasses lang.
>.unwrap()
you should always compute instead of using lookup tables
It's a clever solution, don't be so dismissive. Branchlesss programming is kind of dumb but it's cooler and more in-line with mathematics.
>not elif
Ngmi
No this is moronic.
What you should do is load the target address and jump
the target address should be computed as a base address + an offset
the offset should be computable from your conditionals
finally the code in the range of valid target adresses should be small enough so the entire thing can be piped into the cache so you dont get a cache miss
lists:nth(N,
[{1,0},
{1,-1},
{0,-1},
{-1,-1},
{-1,0},
{-1,1},
{0,1},
{1,1}]).
Would be more readable if you used a dict. Also you don't handle the case of n>8 or n<1
that's just an array if pairs/vector2
Consider this pythonic approach instead:
return tuple([round(- math.sin ( (2*math.pi)/8*x)) for x in [n - 3, n - 1]])
You will notice the following advantages:
- The function now works for numbers outside the range 1:9
- The maths is explicit. For scientific uses consider using math.tau.
- Single line of code
- list comprehension is both powerful and beautiful
- Self documenting
in haskell this is just
pathOrderRender = (!!) [(1,0),(1,-1),(0,-1),(-1,-1),(-1,0),(-1,1),(0,1),(1,1)] . (+) (-1)
You can do " . (-) 1"
but still based.
(the minus symbol is our only weakness)
no you can't I'm stupid...
(flip (-) 1)