My code. Am I doing it right, /g?

My code. Am I doing it right, /g?

Attached: 1529162189882.png (641x883, 37K)

>not using ruby
nope.

Why does it check only if this.Randomize is false?

use a select case

Might consider a dictionary to clean this up.
dict = {
‘“Red”: “1f 0f 0f”
}
Correctcolor = dict[eyecolor]

It’s hard to code on mobile, but you get the idea.

This. Don't store data within the code like that.

Yes. Use a dictionary or a switch case

Code is data

I'd go with something simlar to a dict or an enum for eye color.

Definitely use a switch block

use intellij then right click the warning, convert to switch case

I remember this one
Where can I find more Yandere Sim meme code?

Every time I'm amazed by yanderedev's use of dozens of nested ifs with string comparisons for everything in the game. It's like he intentionally chose the method that requires the most code to be written AND the most resources to be executed.

Attached: 001.png (946x887, 171K)

This will crash if the string is null at any time

use a hash map

Go away eva, you suck

Ways to fix this:
- Replace with a switch block
- Use enumerated types instead of strings
- Consider polymorphism
- Rename Randomize to IsRandomized or IsRandomizeable so as to make it much more clear that it is a boolean type. This principle is called self-commenting code.

lmfao

This.

HashMap eyeColor

Populate it when the constructor fires for the class then test if your input string is null before testing for empty. Assuming you're all good, grab the relevant color by invoking eyeColor.get (inputString)

That Jow Forums thread was gold.

Attached: 002.webm (604x176, 45K)

Attached: 005.webm (320x240, 41K)

Attached: 006.webm (482x160, 119K)

Attached: 007.jpg (281x99, 10K)

If it's C# then there's a built-in class Color that can construct colors from both rgbs or color names.

Thanks senpai

nice

desu during the three years of my bachelor they only told us about hashmap once for a second semester class, and never told us that the search function temporal complexity is constant. Uni is a fucking joke, no wonder people write shit like that.

>mENTALLY disabled
dont hard kode values for something specific into the kode

>I'm amazed by yanderedev's use of dozens of nested ifs
isn't it closed source or did he post some snippets or something?

it's written in XNA which is a c# framework. c# allows code reflection

Literally why isn't this the first post

Switch statement

Maybe he doesn't know any better.

Because it's wrong

He should by now

Maybe the list was generated for performance during execution ;^)

That algorithm has an O(n) time complexity. use a hashmap, which has an O(1) complexity. Hash maps also make your code much more readable and manageable.

You should be using switch

You should be using a dictionary

The minute you have more than like 3 or 4 if statements in a program you should finding different ways to do it

How do you use a dictionary? I've never even heard of the term before

A dictionary is a Hash Map. Script kiddies call it a dictionary because they've only ever coded in python.

Actually both the OP's algorithm and Hash Maps have the same best case ( O(1) ) and worst case ( O(n) ) complexity :^)

Would be JavaScript though

Want to kill myself knowing that too senpai

Colors are constants, you should probably treat them as such

Python's great, you can do almost anything with it

>Am I doing it right, /g?
Only if it works. That's all that matters.

Attached: mature-indian-man-thumbs-up-AKPTTK.jpg (1300x960, 103K)

found the only employed person in this thread

This but unironically

>else if
just use elif

also do what said, use a dict. In python it would be:
colors = {
'White': Color(1f, 1f, 1f),
'Black': Color(0.5f, 0.5f, 0.5f)
}
if self.EyeColor in colors:
self.CorrectColor = colors[self.EyeColor]
else:
self.CorrectColor = Color(0f, 0f, 0f)

Thats what I'm thinking, no one bats an eye when someone switches on a string but when its else ifs arm chair coders come out. I think C# would compile a switch to the same logic as if / elses for anything less than 10 consecutive statements before moving to some weird table lookup.

java has real string switches

yandere sim is made in unity, not xna
also what does code reflection have to do with anything here?

>AND the most resources to be executed.
I doubt that, the compiler should make this equivalent to a switch statement, the same exact code should be executed.
Using a switch statement, while looking nicer, will require the same amount of comparisons.

he streams his development
reminder his excuse for his crap code is 'I didn't ever get a education in it'

gamers get what gamers deserve

Attached: 1500041054313.png (800x450, 133K)

lul it's nothing a good book couldn't fix

Use a switch statement you dumb faggot

"No".
A real switch uses a lookup table. It does 1 comparison.

>A real switch uses a lookup table.
Is it guaranteed that the compiler doesn't optimize that?

I recognise that code, it's from the development of Yandere simulator, the dev is really bad at coding. It's not yours retard

>Using notepad++
Yes user, you are. I'd use at least a switch/case if not a dictionary to clean it up tho

why not?

Hash map worst time complexity can be easily avoided by having a uniform key distribution.

How would a hashmap be any faster than a switch statement with all the different colors as strings?

No they don't. If you had 1000 colors it would take on average n/2 basic operations to find the color with OP's. With a Hash Map, increasing the count wouldn't increase the number of basic operations