Author Topic: Programming Megathread  (Read 106294 times)

I was joking, lol. There was way too much ambiguity in what I said, while it technically holds true, what I said is similar to someone saying "teach me math" and replying "to get the y-intercepts of a quadratic curve, find the factors."

Ah I gotcha. I've never heard them called y-intercepts, lol.

Where the forget is Torque?

Where the forget is Torque?

the scripting language that blockland uses

Ah I gotcha. I've never heard them called y-intercepts, lol.

Yeah, because the curve intersects the Y axis.

Yeah, because the curve intersects the Y axis.

Yeah I always called them zeroes lmao



WHERE
If you read the wikipedia page you'd know that torque is located on the perpendicular axis to the acting force and position vectors.

Where the forget is Torque?
it's approximately right there

bumping this cause why not, my function here can't seem to round down to 2 decimal places

Quote from: vb.net
Public Class Form1
    Dim vara As Integer
    Dim varb As Integer
    Dim varc As Integer
    Dim root1 As Decimal
    Dim root2 As Decimal
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()

        vara = InputBox("Enter a")
        varb = InputBox("Enter b")
        varc = InputBox("Enter c")

        quadrat(vara, varb, varc, root1, root2)

        ListBox1.Items.Add("Root 1: " & root1 & "     Root 2: " & root2)
    End Sub

    Function quadrat(ByVal vara As Integer, ByVal varb As Integer, ByVal varc As Integer, ByRef root1 As Decimal, ByRef root2 As Decimal)
        '(-b +- sqrt(b^2 - 4ac)) / 2

        root2 = (-varb - Math.Sqrt((varb ^ 2) - (4 * vara * varc))) / 2
        root1 = (-varb + Math.Sqrt((varb ^ 2) - (4 * vara * varc))) / 2

        Decimal.Round(root1, 2, MidpointRounding.AwayFromZero)
        Decimal.Round(root2, 2, MidpointRounding.AwayFromZero)

        Return root1 & root2
    End Function

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()

        For counter = 1 To 10
            vara = (9 * Rnd() + 1) + 1
            varb = (9 * Rnd() + 1) + 1
            varc = (9 * Rnd() + 1) + 1

            quadrat(vara, varb, varc, root1, root2)

            ListBox1.Items.Add("Root 1: " & root1 & "     Root 2: " & root2)
        Next
    End Sub
End Class

it's giving really, really long decimal values instead and I can't seem to get it to work even though I've tried googling, could it be cause I'm rounding inside the function and then returning it or what

help

it's approximately right there
lmfao

EDIT: got it working, I just ended up rounding inside both of the add items functions
« Last Edit: July 24, 2016, 08:50:06 AM by Maxwell. »

I want to learn to code, which language should I start out with?

I want to learn to code, which language should I start out with?
depends on what you wanna do

bumping this cause why not, my function here can't seem to round down to 2 decimal places
Why are you returning the roots if you're passing them by ref?
Also I'm pretty sure Decimal.Round returns the rounded value, not modifies by ref. So you're not assigning the return value to anything.


depends on what you wanna do
Yeah, do you know what you want?
Like, web applications? Games? Phone apps? Or just...general desktop software

depends on what you wanna do
Probably stuffty games and Blockland mods for now.

Probably stuffty games and Blockland mods for now.
Well your only option for Blocklands mods is TorqueScript.
For games, don't worry about what language you want to use, instead decide what engine you want to use (since it's doubtful you'll be coding your own, unless you want something really basic). Then you just use whatever language that engine uses.