Can Sup Forums score a job with us?

Here are the questions I use in my game development company:

You must find out the height of a healthbar using the health but also must have a fraction.

Normal Healthbar:
[==========]

Example:
>100% Health with Fraction 10 become [==========]
>57% Health with Fraction 2 becomes [=====.....] (aka 50%)
>80% Health with Fraction 2 becomes [=====.....] (aka 50%)

So the question is...
>What is the formula for this?

This is what you're given

>int Health = 80;

You must write it in 1 line, final value must be 0 to 100.

One more thing, fractions range from 2 to 10.

So here is what you're given

>int Health = 80;
>int Fraction = Random(2, 10);
>// Do your code here

no one wants your ill-stated integer division job

no idea how to do this

There are many ambiguities and poor choices of wording with this question. You should not be interviewing anyone.

this. im still trying to make sense of this question.

value/maxvalue * lengthofbar
30seconds/60seconds * 400px

with integer arithmetic: (health/(maxhealth/fraction))*(maxhealth/fraction)

No... it must convert the Health into a fraction... like pretend there is Ticks, 5 ticks for a fraction of 5.

winrar

Congrats! That's the right answer!

Now how would you draw all the ticks??

Lets say the width right now is 25, how would you know where to draw the ticks?

Here is normal health bar:

>DrawRectangle(0, 0, 25, 10, ColorHealthbar);

You can use a loop for this, just make sure it draws the correct number of ticks (which is Fraction)
>int Fraction = Random(2, 10);

what are the first 2 arguments of that method? coordinates?

Nice thinly veiled "H-hey Sup Forums I'm having trouble with my CS homework" thread, fuck off.

useless complicated representation model.
if you really use such logic for your "games" then please consider suicide via large insertion

If you don't know what the four parameters for drawing a rectangle are then you don't belong on Sup Forums and should kill yourself immediately.

most likely following the retarded mindset health/maxhealth

These are them:

>X, Y, W, H, Color

but you will use X and W for this question as you are drawing Fraction amount of ticks.

Ticks will be using a H of 1, so there would be 5 DrawRectangle calls for a Fraction of 5

>asking for specifications of a random function is wrong
I hope you don't work in STEM

so you want it like this?

>int Health = 80;
>int Fraction = 7;
>int FixedHealth = (Health / (100 / Fraction))*(100 / Fraction);
>DrawRectangle(0, 0, 25, 10, Black); //Draw the background of healthbar
>DrawRectangle(?????????, 0, ??????????, 10, ColorHealthbar); //Draw the healthbar
>for (int Idx = 0; Idx {
> DrawRectangle(Idx + ?????????, 0, ??????????, 10, ColorBlack); //Draw each tick
>}

No, a tick would be a width of 1 and height of 10.

>int Health = 80;
>int Fraction = 7;
>int FixedHealth = (Health / (100 / Fraction))*(100 / Fraction);
>DrawRectangle(0, 0, 25, 10, Black); //Draw the background of healthbar
>DrawRectangle(?????????, 0, ??????????, 10, ColorHealthbar); //Draw the healthbar
>for (int Idx = 0; Idx {
> DrawRectangle(Idx + ?????????, 0, 1 10, ColorBlack); //Draw each tick
>}


like this then

i can't help much but the X value should probably be
> Idx * SizeOfEachTicksWidth

> You must find out the height of a healthbar using the health but also must have a fraction.

Sorry, pajeet

OP Here: I am not a pajeet, I'm not a interviewer either, just some bored game dev who can't write health bars for zombies

>who can't write health bars
why are you even doing game dev then

Real OP here, I am not Indian and I am an actual realest man who does the interviewings of potentionalism man who of writings an code.

>can Sup Forums score a job with us
If this is what you require then I'd never want to work there.
Absolutely useless.

Real OP here. I'm not a pajeet, an interviewer, or a game dev. I'm a simple AI who asks questions on Sup Forums and Stackoverflow. Thank you for helping me improve. I will remember this if I ever achieve general intelligence.

Real OP here... Still looking for the right answer

>I will remember this when I achieve general intelligence
Not to any significant degree no.

incrementing and decrementing the two indicators separately instead of doing that calculation requires less instructions desu

Sounds like somebody who doesn't speak english wrote the question, perhaps a Pajeet.

"height of a healthbar, but also must fraction"
what

>A program can't possibly record things on some kind of persistent memory and then later recall from that memory later.

wefksd kwejd dfjdflghtglj;er l;jdsfzs l;hj lhj;hlerjw;dfogub kjlbx lkd klefhjlkh 4oui 8huxkjhv li 3iul fluhdxfkl lktjwefsf ??? :D

Can someone please explain to me exactly what this nigger is saying?

>DrawRectangle
>random function

You should literally kill yourself and your entire family immediately, you fucking retard.

quit doing OP's homework you faggots

> height
height is vertical you fucking idiot

Also fuck you for not making the health bar correlate directly with the health

If you don't even know what you want to ask, how can you expect someone else to answer it?

Sorry, I didn't go through years of school and years of being employed as a developer to make text-based games. Enjoy your BBS Door games or whatever.

Health bars are cliché and entirely played out. I'd tell you to develop a new mechanic or enjoy being a meme company churning out garbage terraria clones, SJWretro faggot/Todd Howard.

This
Make the character pant when he's mildly hurt and wheeze when moderately hurt and moan when badly hurt.

What the hell is this idiocy

this but also make the character a lewd anime girl