Hack Forums
[.NET] / [Snippet] Sport bet(s) accumulator function. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] / [Snippet] Sport bet(s) accumulator function. (/showthread.php?tid=3318269)



/ [Snippet] Sport bet(s) accumulator function. - SomeWhiteGuy - Mar 10, 2013

The user Nov asked me to help with this "Sport Bet Accumulator Calculator".

I myself have never fucked with anything regarding betting and sports and shit like that, but I gave it a try. After a while, I finally got it.

Here's the function and the other shit you'll need:
http://pastebin.com/yy29KrYx

How to call it:
Code
tbResult.Text = calcBets(Integer.Parse(tbStake.Text), num1.Value / num11.Value, num2.Value / num22.Value, num3.Value / num33.Value, num4.Value / num44.Value)

tbResult is the TextBox that will be the result of the calculations, where we will set it's value to the result of the function.
Integer.Parse is used to get the number equivalent of a String.

Then you supply divisions of the other values.

In this format: # / #, # / #, # / #

and so on.

Here's a screen shot of the little app I made while I was testing this:
Spoiler (Click to View)

Oh and note, while I only supplied 4 odd inputs, it supports any amount.

I'm not too sure if I did this the best way, so any criticism is welcome.

Thank you.


* - Hackedbyak47imaskid - Mar 11, 2013

Good job, SWG.
I'm gonna use this sometime.


* - H3x0S - Mar 11, 2013

Code could've been better. Property is useless here.


* - SomeWhiteGuy - Mar 11, 2013

(Mar 11, 2013 07:37 AM)H3x0S Wrote:  Code could've been better. Property is useless here.

That could've just been a privately declared integer probably, I don't really remember what I was thinking when I added the property; but at the time that was the most probable option in my opinion.

Thanks for the comments the both of you.


* - Smelly Shoes - Mar 11, 2013

Code
'Private _val As Integer This is no longer needed, even if it was = Nothing is not necessary.
'If you're using a later version you don't have to use get/set.

Why are you using a While true and the UBound function..? >_>

Code
For i As Integer = 0 To odds.Length
   odds(i) 'Durp.
Next



* - SomeWhiteGuy - Mar 11, 2013

(Mar 11, 2013 01:47 PM)Smelly Shoes Wrote:  
Code
'Private _val As Integer This is no longer needed, even if it was = Nothing is not necessary.
'If you're using a later version you don't have to use get/set.

Why are you using a While true and the UBound function..? >_>

Code
For i As Integer = 0 To odds.Length
   odds(i) 'Durp.
Next

I always initialize variables.

I probably should've used the Length property in this case, considering I used UBound and then said "add 1" which takes away from the purpose lol.

And this is one of those "releases" where I just tried a bunch of different shit and when I finally got it to work dumped the code on y'all.

Another reason why I said: "I'm not too sure if I did this the best way, so any criticism is welcome."

So, thanks for the criticism. :p