I know nothing about CSS (assuming this is CSS) but wouldn't it be easier to divide the given number by 2 and filter out any result that gives a decimal point?
CS, like Computer Science. Yes, that's how one does it. They use the modulo operation which divides and returns the remainder. So they would go something like
isEven = userNumber % 2 == 0
If the remainder is 0, then yes, it is an even number
I know nothing about CSS (assuming this is CSS) but wouldn't it be easier to divide the given number by 2 and filter out any result that gives a decimal point?
CS, like Computer Science. Yes, that's how one does it. They use the modulo operation which divides and returns the remainder. So they would go something like
isEven = userNumber % 2 == 0
If the remainder is 0, then yes, it is an even number
Your code wouldn't work because 0 is even but 0 % 2 = 2.
>num%2 == 0 ? true : false
I wanted to disprove you by booting up a Java Replit and screen capping it. But Java is so fricking anus that it actually immediatlly hit max CPU and RAM with literally just hello world.
So you win anon.
If I had to parse code quickly, I'd probably prefer the first version (more compacted), yes. I don't want to have to use brain power to wonder why there's a ? and : next to each other, but then I again I don't do this coding nerd stuff.
You don't use brain power at all to understand what a ternary operation does when you know what it actually does.
"(expression) ? if true do this : if false do this instead;", no trouble whatsoever.
It depends. It fits on one line and involves no indentation, so it keeps the code a lot more compact. But like you said it's harder to understand unless you know the language. Ultimately it comes down to personal preference and style, as long as you're using some variation of x%2 it's pretty much the same efficiency anyway.
I can read it just fine? I just wonder if it's worth the minimal code reduction. What are prog languages if not an abstraction, easy for the human to write and read?
>Is this supposed to be more readable than an if... else?
You will be surprised but "if... else" is also syntactic sugar and a simplified form of real conditional expression (with multiple predicates).
i used to love RPG maker as a kid but this image is triggering.
anyway, world of warcraft. never forgot that players were asking for green warlock fire for 10 years and the devs kept saying there were "tech limitations." b***h just fricking hue shift the fricking PNGs of the spell effects. stupid ass game.
I bet termina sold at least 10k copy can't he hire someone to program in gamemaker or something, at least in the engine that actually let you do stuff?
Red Dead Redemption 1. other R* team had the tools the GTAIV team had and did all sorts of wacky shit to get it right. Ended up a big mess under the hood and is probably the main reason it's not remastered or ported to PC.
Stellaris used to be absolute spaghetti. The devs have been fixing it for years now and basically doubled the speed at which the game runs by streamlining the spaghetti but it's still probably a mess.
The code isn't any better. They've just streamlined the systems. The problems with the game come with how it handles pops and how important they are to the function of the game.. When they designed the system they didn't realize just how much load they were putting on the engine late game. They've deliberately left the AI shitty at min-maxing for years now and the game still slows to a crawl late game.
I mean, it's RPG Maker. the sole fact there's a UI organizing it and allowing you set everything up in an organized manner means it's not spaghetti code as much as simplifying it for inexperienced people.
Because, you know, RPG Maker is a program that allows people without coding skills to develop a game.
>still nothing compared to some of the insane shit Japs do
pic related is a SMALL EXCERPT of the Enemy AI code for an RPG Maker 2000 SRPG. This used to cause people's systems to chug like no tomorrow back in the single core sub-1GB ram days.
I've played video games for close to 40 years now and the single worst of all time was Diablo 3 having an int32 overflow in a field designed to accept a real-money value, in an auction house
What this means in practice is, say you're selling a crossbow for $30.00. Someone could bid like $30000000000 and win the auction, the amount would wrap around to $0.00 and they would get your item but you'd get paid $0.00.
This is literally a high school computer science mistake. If that.
Video games do not have automated QA for the most part.
Video game devs do not write automated tests and probably struggle to write tests in general.
I am not surprised that no QA tried to smoketest this.
>say you're selling a crossbow for $30.00. Someone could bid like $30000000000 and win the auction, the amount would wrap around to $0.00 and they would get your item but you'd get paid $0.00.
lolling
>electronic payment system
Don't they only do this shit when you pay by card? Means they have the info of the guy who did this. Congratulations, you played yourself.
Dwarf Fortress
Nothing else even comes close
Pokemon RBY
Donkey Kong 64
The LISA trilogy’s code is horribly structured and tedious to navigate which sucks for a series which is heavily known for fan games
Whatever I wrote in CS classes before I dropped out of college
I know nothing about CSS (assuming this is CSS) but wouldn't it be easier to divide the given number by 2 and filter out any result that gives a decimal point?
CS, like Computer Science. Yes, that's how one does it. They use the modulo operation which divides and returns the remainder. So they would go something like
isEven = userNumber % 2 == 0
If the remainder is 0, then yes, it is an even number
num%2 == 0 ? true : false
Your code wouldn't work because 0 is even but 0 % 2 = 2.
>0 is even
Except it isn't.
Yes, it is.
0 % 2 is 0
0/2 = 0 with 0 remainder
Where are you getting 2?
>Where are you getting 2?
From the 2 left over. Frick maths and it's arbitrary rules. The 2 doesn't vanish. It's still there.
2*0 = 0
moron
You are a silly goose
0 is a multiple of 2
How would you feel if I took your 2 and gave you a 0 instead?
>anon can't into law of conservation of matter
>num%2 == 0 ? true : false
I wanted to disprove you by booting up a Java Replit and screen capping it. But Java is so fricking anus that it actually immediatlly hit max CPU and RAM with literally just hello world.
So you win anon.
Just check for the first bit.
>bool IsOdd(int num) { return num & 1; }
I'm getting sick and tired of you pimple faced nerds trying to one up each other
>bitwise operations
Most programmers don't know anything about those things. It makes for "unreadable code".
Not my fault you never dabbled in Z80 or 6502 asm when you were a kid.
I bet you're one of those twats that bitshifts instead of just using arithmetic like a normal person.
>hehe i'll use bits to make everyone know i'm quirky
have a nice day
CS required knowledge of bit operators and things like Two’s Compliment. Has it just been replaced with Java and Web Stack devs?
yes.
>? result1 : result2
Is this supposed to be more readable than an if... else?
>readability
It's a meme. If you trust that your managers will hire competent engineers then ? : is perfectly fine. It's almost a natural gatekeep.
It is. As long as you know what the operator means.
Do you actually think
if (num % 2) == 0
{
return true;
{
else
{
return false;
}
is better than
return num % 2 == 0 ? true : false
If I had to parse code quickly, I'd probably prefer the first version (more compacted), yes. I don't want to have to use brain power to wonder why there's a ? and : next to each other, but then I again I don't do this coding nerd stuff.
You don't use brain power at all to understand what a ternary operation does when you know what it actually does.
"(expression) ? if true do this : if false do this instead;", no trouble whatsoever.
It depends. It fits on one line and involves no indentation, so it keeps the code a lot more compact. But like you said it's harder to understand unless you know the language. Ultimately it comes down to personal preference and style, as long as you're using some variation of x%2 it's pretty much the same efficiency anyway.
Yes its a fricking ternary,
if you cannot read a ternary I literally cannot fricking help you.
I can read it just fine? I just wonder if it's worth the minimal code reduction. What are prog languages if not an abstraction, easy for the human to write and read?
its just really common format for ternaries in most languages besides python, even excel has ternaries that look like that.
>Is this supposed to be more readable than an if... else?
You will be surprised but "if... else" is also syntactic sugar and a simplified form of real conditional expression (with multiple predicates).
>num%2 == 0
already evaluates to a boolean. why the extra short-circuit if?
Yeah you are right. Java handles it so you could just do
return num%2 == 0;
>num=4.652
Checkmate, summarizer.
Type error: num is an int. Only integers can be even.
Nothing wrong with nested ifs
>b-but switch case
That just a mere prettier syntax. The compiler will convert it to ifs again anyway.
>The compiler
>JS
moron
>moron
Yes. The one who codes game in JS is.
RPGmaker uses JS
i used to love RPG maker as a kid but this image is triggering.
anyway, world of warcraft. never forgot that players were asking for green warlock fire for 10 years and the devs kept saying there were "tech limitations." b***h just fricking hue shift the fricking PNGs of the spell effects. stupid ass game.
>hue shift the fricking PNGs
Assets are not code, though.
Are you moronic?
>RPG Maker “code”
I bet termina sold at least 10k copy can't he hire someone to program in gamemaker or something, at least in the engine that actually let you do stuff?
Why should he?
What's wrong with this, exactly? It's ugly but it works. What would you do differently?
>If (any of the above shit that says OFF is ON)
>>End Event Processing
simple as.
>it works.
barley. the game is unoptimised and suffers from recurring frame drops
>f&h has yandere tier code
why does Ganker shill this shitty shovelware again ?
>why does Ganker shill this shitty shovelware again ?
because this site has become reddit 2.0 after 2016
Holy shit shut the frick up for one god damn time kid you aren't fooling anybody
FFXIV might just be the reigning champion.
Red Dead Redemption 1. other R* team had the tools the GTAIV team had and did all sorts of wacky shit to get it right. Ended up a big mess under the hood and is probably the main reason it's not remastered or ported to PC.
Stellaris used to be absolute spaghetti. The devs have been fixing it for years now and basically doubled the speed at which the game runs by streamlining the spaghetti but it's still probably a mess.
The code isn't any better. They've just streamlined the systems. The problems with the game come with how it handles pops and how important they are to the function of the game.. When they designed the system they didn't realize just how much load they were putting on the engine late game. They've deliberately left the AI shitty at min-maxing for years now and the game still slows to a crawl late game.
people shit on ifs but they are actually fast as frick
Are FSMs not a thing with whatever that software is?
I mean, it's RPG Maker. the sole fact there's a UI organizing it and allowing you set everything up in an organized manner means it's not spaghetti code as much as simplifying it for inexperienced people.
Because, you know, RPG Maker is a program that allows people without coding skills to develop a game.
>still nothing compared to some of the insane shit Japs do
pic related is a SMALL EXCERPT of the Enemy AI code for an RPG Maker 2000 SRPG. This used to cause people's systems to chug like no tomorrow back in the single core sub-1GB ram days.
what does this compile to? and what does that actually look like?
It's apparently a custom version of Ruby that compiles into bytecode for their custom VM so who knows?
Uhh... you poorgays realize the average computer nowadays has 16 cores and 3 trillion GB of RAM and so on? Who cares about code optimization lmao
Definitely not for an RPG Maker game of all things
Yandere Sim
Star Citizen
I've played video games for close to 40 years now and the single worst of all time was Diablo 3 having an int32 overflow in a field designed to accept a real-money value, in an auction house
What this means in practice is, say you're selling a crossbow for $30.00. Someone could bid like $30000000000 and win the auction, the amount would wrap around to $0.00 and they would get your item but you'd get paid $0.00.
This is literally a high school computer science mistake. If that.
Video games do not have automated QA for the most part.
Video game devs do not write automated tests and probably struggle to write tests in general.
I am not surprised that no QA tried to smoketest this.
It doesn't need to be fricking automated lmao someone needs to stop and think at some part of the process
Not having automated tests is fricking caveman tier,
It allows moronic mistakes like this to be discovered more quickly.
Not the point. It's a company that takes in like 8 billion dollars in profit a year. It should've never happened, that makes it all the more egregious
they effectively stole money from people and then the support response in the end was "lmao"
>say you're selling a crossbow for $30.00. Someone could bid like $30000000000 and win the auction, the amount would wrap around to $0.00 and they would get your item but you'd get paid $0.00.
lolling
>shitposting on Ganker at age 50
You okay man?
what else is there to do
The older you get, the more acceptable it is to shit post. What else are you going to do.
sometimes this happens irl too
This is a digital and physical crime, hope whoever did this was arrested
>electronic payment system
Don't they only do this shit when you pay by card? Means they have the info of the guy who did this. Congratulations, you played yourself.
i mean is it really fraud if it lets you do it
They approved the charge. It's their fault.
>$13 for a biscuit
since that story i always started using unsigned ints/longs