Hey guys,
Do you know how to make uncertainty in Ruby?
I am making a exam project for school, in which we have to code a simple rocket engine controller.
2 tanks, one with oxygen and one with fuel and an ignition chamber where the two tanks are connected to.
The program is build around a sequencer, which counts from -10 (T-10) to 10 (T+10). At 0 (T-0) it opens the vents of the two tanks and lets in pressure to the ignition chamber - let's say 10 bars at T-0.
Then the program decreases the pressure of the ignition chamber by 10% every 1 second from T-0 to T-10 - ALL THIS WORKS SO FAR.
HERE IS MY PROBLEM: We need to make an uncertainty - as in a real rocket engine (let's say there is a 10% chance that one of the tanks are letting in too much/little pressure)... Then we also need to implement a WARNING sign (in case the uncertainy happens) + a way to stop the engine/program.
How do I code / implement this into the program? I am searched everywhere and can't find anything related to uncertainty in Ruby programming.
Thank you so much!
Bump!
>>51646774
There's a built-in rand() method that will help you. With no parameters, it just returns a float between 0 and 1.
http://ruby-doc.org/core-2.2.0/Kernel.html#method-i-rand
>>51646818
>begin a kuck
>>51646774
hey there nice to meet you!
Welcome to our little forum!
Yeah I love ruby. I was one of the founders of Ruby on Rails.
I'd be happy to get together with you on skype if you ever needed any help. I'm usually around 9pm to 4am EST.
Also, feel free to let me know if you need anything else. I can really help your career with connections and stuff.
I don't have a girlfriend right now so I have a bit more free time than usual. So it's really good to be diverse and help people!
>>51646774
>woman can't code
>asks 4chan for help
wew lad
>>51646846
?
What's wrong with the official ruby documentation?
>>51646888
Oh I didn't even read the subject. Guess OP trolled me good :-)
>>51646774
You know the rules. Show us your code or gtfo.
>>51646887
Erhm, I am a girl... studying Business Economics and IT... first semester. And Ruby is quite a challenge...
>>51646916
>replies only to troll bait
Way to be obvious, OP. This is why /g/ is shit
>>51646916
Perhaps this will help you anon, because it seems you forgot one of the most important rules.
def startSequencer()
time = @startTime
while time < @endTime do
@state = "started"
time += 1
sleep 1
puts time
if time <= 0
puts "Overview of pressure situation: \n "
puts $Fuel.getType + " is " + $Fuel.getPressure.to_s + " Bar"
puts $LOX.getType + " is " + $LOX.getPressure.to_s + " Bar"
puts $Chamber.getType + " is " + $Chamber.getPressure.to_s + " Bar"
puts "\n"
puts "State: Vents closed"
puts "\n"
end
if time == 0
then puts "Opening the vents"
puts "\n"
end
if time >= 1 then
puts "Overview of pressure situation: \n "
puts $Fuel.getType + " is " + $Fuel.TenPercentLower.to_s + " Bar"
puts $LOX.getType + " is " + $LOX.TenPercentLower.to_s + " Bar"
puts $Chamber.getType + " is " + $Chamber.TenPercentLower.to_s + " Bar"
puts "\n"
puts "State: Vents opened"
puts "\n"
end
end
@state = "stop"
end
end
seq = Sequencer.new(-10,10)
seq.startSequencer()
>>51646928
>>51646846
>>51646774
hey its me again
ignore there jerks
give me your skype and lets chat there ok
dont worry everythng will be ok
>>51646818
Thank u very much :)
>>51646953
just the feel of you hurting baby gurl
>>51646975
hey np... ne time
got fb?
we can message more here
really excited to get to know you more!!!
>>51647016
>>51646953
Ok guys maybe Im not the best at Ruby but Im not stupid :D it is not happening...
rand() is the answer
but the real question is, why do girls like ruby so much?
>>51647045
>it is not happening...
whats not happening????
im not anonymous.. im serious.
>>51646928
As said by René Magritte, "stupidity is a very distressing show but the scornfulness of a pathetic shitbag has something comforting".
Get. The. Fuck. Out. Of. There.
>>51646916
You are probably fat and everybody who ever loved you, left you. Stop cu.cking us you succubus
>inb4 REEEEEEEEEEEEEE
>>51646953
sent ;)
Tits or GTFO.
>>51647047
Why do you think they like Ruby, anon?
If there was a language called diamond, they'd probably be all over that.
>>51646774
Next time leave the
>femanon
Away. Seriously. Stop trying to get attention like that. Other than that: I dont know shit about tech. Cya.
>>51647376
Get out, white knight
DON'T HIT ON ME SILLY GUYS XDDD
>>51648134
Why does she even say that shes female? Thats not fucking relevant. Sensing the stance of attenion-seeking (whoring is so harsh :^})
>>51648174
because she'll reward with sex to whoever helps out, duh
>>51646774
Just try on lolcow.farm
>>51648212
Oh... A pity i dont know shit about ruby .... Or sex.
omg you guys are such meanies
I'm gonna tell everyone on my tumblr about how bad this place is :^(
>>51648288
thanks
I think it is falling for a bait when people ask for tits whenever someone claims she is a femanon.
Think of it:
>a girl
>on /g/
>asking about programming
Chances are that the bitch is fat with soggy, ugly tits, or is just a man trolling. Either way, that's not good.
>>51646774
women, amirite /g/? what went wrong with these cum dumpsters? why won't they stay in the kitchen?
>>51648326
I dont think this is my case 90x68x90 , 170cm , long brown hair... ;)
>>51646774
Tits or GTFO
>>51646774
>I am making a exam project for school
exam... project?
>>51648449
Without pics and timestamps, you are a fat nigger, male, still a virgin, not gay but has those pillow waifus.
>>51646774
>HELP A FEMANON OUT
2/10 bait kek
>>51646774
I bet you're /fit/ and have great glutes
post'em