We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

help with commodore 64 basic.....

Options
2»

Comments

  • Blakespops
    Blakespops Posts: 394 Forumite
    Which betting site do you use , I am sure most should accept perms for scoop 6. Failing that I will have a think before Saturday. Do you have any thing like a Unix Box or Excel ( Unix would be easier or perl/python perhaps for windows my perl/python are rusty but hey I lie a challenge ... [STRIKE]esp for 10%[/STRIKE]
    I know what you wan't to do but b*gg*r me putting in 100+ single occurrences of your scoop 6 means getting up early on Saturday:eek:
    As I say in opening post I am wishing to do cover bets of lucky 63's using selections too. VC allow the bets at just 1p stake so doing 144 of them covering all the horses can give good cover and return good funds for the small stake. have in past had 5 winners but not yet had all 6. this way the fact that even if only have three or four winners I would make a profit at the prices I normaly like to aim at. I never back Fav if it is lower than evens and then maybe only once or twice a month. normally I aim at 7-1 or higher.

    so as stated doing the scoop six and covering bets is aim and no bookie allows perm lucky 63 so have to spend hours placing them. retaining selections and then deleting one and changing that race's horse for my next selection etc until I get fed up and stop. Yes scoop 6 is a good payout if all correct and you get place part but if lose in first race and have next five winners it is a sickener, I know for a fact as it happened to me.

    I started last year when they took over sponsership of Nottingham Forest as offered us a few incentives and have built up my money held by them, this full cover of the selections will be my first time covering all this way but will do it every week if I turn a profit or am close to doing so.
    Only through Christ can we find freedom
  • Richie(UK)
    Richie(UK) Posts: 284 Forumite
    Hi there,

    I'll get my caveat out of the way first ;) The routine is pretty 'quick and dirty', I have only tested it briefly and it does not contain any error-handling. I have pasted the routine below rather than trying to attach a workbook as, firstly, I'm not sure that MSE permits the attachment of files and, secondly, you should generally be wary of downloading files containing macros when you don't know the author (at the very least you should not enable them initially until you have had a chance to review the code in question).

    The routine assumes that the horse names are entered on a worksheet called "Sheet1". It also assumes that the horse names for race 1 are listed in column A, starting at A1, the horse names for race 2 are listed in column B, starting at B1, etc etc up to column F for race 6.

    The combinations are output into column H and a messagebox gives a count of the number of combinations (you can delete this if you wish, I just added it to make sure I was coming up with the number that you expected).

    Give it a try and see how you get on. I'm sure I, or somebody else, can amend it if needs be.
    Sub Tote6()
        
        Dim ws As Worksheet
        'the data worksheet
        Dim vArr1 As Variant, vArr2 As Variant, vArr3 As Variant
        Dim vArr4 As Variant, vArr5 As Variant, vArr6 As Variant
        'arrays to hold data from the ranges listing the horses
        Dim lCount1 As Long, lCount2 As Long, lCount3 As Long
        Dim lCount4 As Long, lCount5 As Long, lCount6 As Long
        'counters for looping through arrays
        Dim lRow As Long
        'counter for row output
        
        Set ws = ThisWorkbook.Worksheets("Sheet1")
        'the worksheet we will be using
        
        With ws
            vArr1 = .Range("A1:A" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
            vArr2 = .Range("B1:B" & .Cells(Rows.Count, 2).End(xlUp).Row).Value
            vArr3 = .Range("C1:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Value
            vArr4 = .Range("D1:D" & .Cells(Rows.Count, 4).End(xlUp).Row).Value
            vArr5 = .Range("E1:E" & .Cells(Rows.Count, 5).End(xlUp).Row).Value
            vArr6 = .Range("F1:F" & .Cells(Rows.Count, 6).End(xlUp).Row).Value
        End With
        'populate the arrays with data from the ranges
        
        Application.ScreenUpdating = False
        'switch off during output
        
        ws.Columns(8).Clear
        'delete previous output
        lRow = 0
        'reset counter
        
        For lCount1 = LBound(vArr1, 1) To UBound(vArr1, 1)
            For lCount2 = LBound(vArr2, 1) To UBound(vArr2, 1)
                For lCount3 = LBound(vArr3, 1) To UBound(vArr3, 1)
                    For lCount4 = LBound(vArr4, 1) To UBound(vArr4, 1)
                        For lCount5 = LBound(vArr5, 1) To UBound(vArr5, 1)
                            For lCount6 = LBound(vArr6, 1) To UBound(vArr6, 1)
                                lRow = lRow + 1
                                'increment row counter for output
                                ws.Cells(lRow, 8).Value = _
                                    vArr1(lCount1, 1) & ", " & vArr2(lCount2, 1) & ", " & vArr3(lCount3, 1) _
                                    & ", " & vArr4(lCount4, 1) & ", " & vArr5(lCount5, 1) & ", " & vArr6(lCount6, 1)
                                    'record each combo in column 8 (H)
                            Next lCount6
                        Next lCount5
                    Next lCount4
                Next lCount3
            Next lCount2
        Next lCount1
        'loop through arrays to produce combinations
        
        ws.Columns(8).EntireColumn.AutoFit
        'adjust display
        Application.ScreenUpdating = True
        'switch on again
        
        MsgBox "Combinations counted : " & lRow
        'show count of combinations
        
    End Sub
    
    «««¤ Richie ¤»»»
  • Blakespops
    Blakespops Posts: 394 Forumite
    Richie(UK) wrote: »
    Hi there,

    I'll get my caveat out of the way first ;) The routine is pretty 'quick and dirty', I have only tested it briefly and it does not contain any error-handling. I have pasted the routine below rather than trying to attach a workbook as, firstly, I'm not sure that MSE permits the attachment of files and, secondly, you should generally be wary of downloading files containing macros when you don't know the author (at the very least you should not enable them initially until you have had a chance to review the code in question).

    The routine assumes that the horse names are entered on a worksheet called "Sheet1". It also assumes that the horse names for race 1 are listed in column A, starting at A1, the horse names for race 2 are listed in column B, starting at B1, etc etc up to column F for race 6.

    The combinations are output into column H and a messagebox gives a count of the number of combinations (you can delete this if you wish, I just added it to make sure I was coming up with the number that you expected).

    Give it a try and see how you get on. I'm sure I, or somebody else, can amend it if needs be.
    Sub Tote6()
     
        Dim ws As Worksheet
        'the data worksheet
        Dim vArr1 As Variant, vArr2 As Variant, vArr3 As Variant
        Dim vArr4 As Variant, vArr5 As Variant, vArr6 As Variant
        'arrays to hold data from the ranges listing the horses
        Dim lCount1 As Long, lCount2 As Long, lCount3 As Long
        Dim lCount4 As Long, lCount5 As Long, lCount6 As Long
        'counters for looping through arrays
        Dim lRow As Long
        'counter for row output
     
        Set ws = ThisWorkbook.Worksheets("Sheet1")
        'the worksheet we will be using
     
        With ws
            vArr1 = .Range("A1:A" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
            vArr2 = .Range("B1:B" & .Cells(Rows.Count, 2).End(xlUp).Row).Value
            vArr3 = .Range("C1:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Value
            vArr4 = .Range("D1:D" & .Cells(Rows.Count, 4).End(xlUp).Row).Value
            vArr5 = .Range("E1:E" & .Cells(Rows.Count, 5).End(xlUp).Row).Value
            vArr6 = .Range("F1:F" & .Cells(Rows.Count, 6).End(xlUp).Row).Value
        End With
        'populate the arrays with data from the ranges
     
        Application.ScreenUpdating = False
        'switch off during output
     
        ws.Columns(8).Clear
        'delete previous output
        lRow = 0
        'reset counter
     
        For lCount1 = LBound(vArr1, 1) To UBound(vArr1, 1)
            For lCount2 = LBound(vArr2, 1) To UBound(vArr2, 1)
                For lCount3 = LBound(vArr3, 1) To UBound(vArr3, 1)
                    For lCount4 = LBound(vArr4, 1) To UBound(vArr4, 1)
                        For lCount5 = LBound(vArr5, 1) To UBound(vArr5, 1)
                            For lCount6 = LBound(vArr6, 1) To UBound(vArr6, 1)
                                lRow = lRow + 1
                                'increment row counter for output
                                ws.Cells(lRow, 8).Value = _
                                    vArr1(lCount1, 1) & ", " & vArr2(lCount2, 1) & ", " & vArr3(lCount3, 1) _
                                    & ", " & vArr4(lCount4, 1) & ", " & vArr5(lCount5, 1) & ", " & vArr6(lCount6, 1)
                                    'record each combo in column 8 (H)
                            Next lCount6
                        Next lCount5
                    Next lCount4
                Next lCount3
            Next lCount2
        Next lCount1
        'loop through arrays to produce combinations
     
        ws.Columns(8).EntireColumn.AutoFit
        'adjust display
        Application.ScreenUpdating = True
        'switch on again
     
        MsgBox "Combinations counted : " & lRow
        'show count of combinations
     
    End Sub
    
    Thank you so much seems to work wonders will try it our tomorrow at York and let you know how I get on.

    also are you a betting man? if so send me a private message with a contact e-mail and as a way of repaying you for help will give you the tips my brother in law gives me as he is assistant trainer at a small yard. small but get good results on ones they lay out for a gamble.if you wish to have time to build up confidance on tips just watch first couple you get at around 8 am on day of gamble, you will love their strike rate for sure.
    Only through Christ can we find freedom
  • Richie(UK)
    Richie(UK) Posts: 284 Forumite
    Hi,

    I'm glad that it seems to work OK.

    There's no need for any repayment, whatever form it takes. Like many others here, if I post something useful its because I enjoy the challenge and/or like to help people. Besides, I'm sometimes a question asker and I wouldn't want there to be a payment precedent set ;)

    Good luck at York.
    «««¤ Richie ¤»»»
  • Blakespops
    Blakespops Posts: 394 Forumite
    Richie(UK) wrote: »
    Hi,

    I'm glad that it seems to work OK.

    There's no need for any repayment, whatever form it takes. Like many others here, if I post something useful its because I enjoy the challenge and/or like to help people. Besides, I'm sometimes a question asker and I wouldn't want there to be a payment precedent set ;)

    Good luck at York.
    My wife says now my Sat morning is taken up inputting all the bets and the afternoon with Football/horses. she wants a big bunch of flowers every week now. told her my aim is to win enough for us to move back to america..... well I can dream.

    stuck here in wheelchair and just looking at ways I can find to take mind off pain this has been a nice distraction. I only bet with £10.00 a week as that is what we used to put on lottery. and am allowed to play with any winnings less than £1000 although we just said will save it in account for christmas for our son ( only to buy him a gift every month and put it away, guess shows how much faith she had in my ability lol.) I have enough in account to do the 144 bets plus the scoop six once so will be crossing fingers this weekend. and as for making a payment if I win the £500,000.00 bonus you will have to let me buy you a drink at least lol.

    one last quick question, as the horses win can I run a filter so the list showing on computer will show how many lines are still standing? plus at the end say I am lucky and have 4 winners could I pull up all that have them 4 in?
    Only through Christ can we find freedom
  • debitcardmayhem
    debitcardmayhem Posts: 12,686 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    Richie(UK) wrote: »
    Hi,

    I'm glad that it seems to work OK.

    There's no need for any repayment, whatever form it takes. Like many others here, if I post something useful its because I enjoy the challenge and/or like to help people. Besides, I'm sometimes a question asker and I wouldn't want there to be a payment precedent set ;)

    Good luck at York.

    B*gger it I will still work on my generic version (ie 2 --> x legs + variable selections in each leg I like a challenge too, mind you my brain is fuddled at times)
    Well done Richie and also good luck Andy with your endeavours
    As they say be lucky :rotfl:
    4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy
  • Richie(UK)
    Richie(UK) Posts: 284 Forumite
    B*gger it I will still work on my generic version (ie 2 --> x legs + variable selections in each leg I like a challenge too, mind you my brain is fuddled at times)
    Well done Richie and also good luck Andy with your endeavours
    As they say be lucky :rotfl:

    Don't let my first hash put you off doing something better. I'm sure the multi-loop approach isn't particularly efficient. And something where you can enter any number of races rather than a set 6 would certainly be neater. I suppose some sort of recursive function may be the way to go.

    Blakespops,
    A filter is certainly the simplest (and probably the best) approach for what you suggest. I'll see if I can fit in a quick re-write later so that the horses are output into consecutive cells rather than all in a single cell. It may not be as visually pleasing as a list but it will help with the filtering.
    «««¤ Richie ¤»»»
  • Richie(UK)
    Richie(UK) Posts: 284 Forumite
    Hi again,

    Quick re-hash of code shown below. Please note that data entry for the races now starts one row down, at A2. This is so that we can have a header row for filtering the results.
    Sub Tote6()
        
        Dim ws As Worksheet
        'the data worksheet
        Dim vArr1 As Variant, vArr2 As Variant, vArr3 As Variant
        Dim vArr4 As Variant, vArr5 As Variant, vArr6 As Variant
        'arrays to hold data from the ranges listing the horses
        Dim lCount1 As Long, lCount2 As Long, lCount3 As Long
        Dim lCount4 As Long, lCount5 As Long, lCount6 As Long
        'counters for looping through arrays
        Dim lRow As Long
        'counter for row output
        
        Set ws = ThisWorkbook.Worksheets("Sheet1")
        'the worksheet we will be using
        
        With ws
            vArr1 = .Range("A2:A" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
            vArr2 = .Range("B2:B" & .Cells(Rows.Count, 2).End(xlUp).Row).Value
            vArr3 = .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Value
            vArr4 = .Range("D2:D" & .Cells(Rows.Count, 4).End(xlUp).Row).Value
            vArr5 = .Range("E2:E" & .Cells(Rows.Count, 5).End(xlUp).Row).Value
            vArr6 = .Range("F2:F" & .Cells(Rows.Count, 6).End(xlUp).Row).Value
        End With
        'populate the arrays with data from the ranges
        
        Application.ScreenUpdating = False
        'switch off during output
        
        ws.Columns("H:M").Clear
        'delete previous output
        ws.Range("H1:M1").Value = "Header"
        'add header line for filtering
        lRow = 1
        'reset counter
        
        For lCount1 = LBound(vArr1, 1) To UBound(vArr1, 1)
            For lCount2 = LBound(vArr2, 1) To UBound(vArr2, 1)
                For lCount3 = LBound(vArr3, 1) To UBound(vArr3, 1)
                    For lCount4 = LBound(vArr4, 1) To UBound(vArr4, 1)
                        For lCount5 = LBound(vArr5, 1) To UBound(vArr5, 1)
                            For lCount6 = LBound(vArr6, 1) To UBound(vArr6, 1)
                                lRow = lRow + 1
                                'increment row counter for output
                                With ws
                                    .Cells(lRow, 8).Value = vArr1(lCount1, 1)
                                    .Cells(lRow, 9).Value = vArr2(lCount2, 1)
                                    .Cells(lRow, 10).Value = vArr3(lCount3, 1)
                                    .Cells(lRow, 11).Value = vArr4(lCount4, 1)
                                    .Cells(lRow, 12).Value = vArr5(lCount5, 1)
                                    .Cells(lRow, 13).Value = vArr6(lCount6, 1)
                                End With
                                'record each combo in columns 8-13 (H-M)
                            Next lCount6
                        Next lCount5
                    Next lCount4
                Next lCount3
            Next lCount2
        Next lCount1
        'loop through arrays to produce combinations
        
        ws.Columns("H:M").EntireColumn.AutoFit
        'adjust display
        Application.ScreenUpdating = True
        'switch on again
        
        MsgBox "Combinations counted : " & lRow - 1
        'show count of combinations
        
    End Sub
    
    «««¤ Richie ¤»»»
  • NiVZ
    NiVZ Posts: 174 Forumite
    edited 24 August 2010 at 4:15PM
    Hello,

    Here is a very quickly written script that will show all combinations for ANY number of events.

    You'll need to download AutoIT from http://www.autoitscript.com

    Then paste the following in:
    #include <Array.au3>
    $Number = 0
    Do
    $Number = InputBox("Combinations", "Enter number of events:")
    If $Number = "" Then Exit
    If $Number = 0 Then MsgBox(16, "Combinations", "Cannot have zero events")
    Until $Number > 0
    Dim $aArray[$Number]
    For $i = 0 To $Number-1
    ;$aArray[$i] = $i+1

    $Name = ""

    Do
    $Name = InputBox("Enter Name", "Enter name for this event" & $i+1)
    If $Name = "" Then MsgBox(16, "Combinations", "Name cannot be blank")
    Until $Name <> ""

    $aArray[$i] = $Name

    Next
    For $i = 1 To UBound($aArray)
    $aArrayCombo = _ArrayCombinations($aArray, $i, ",")
    _ArrayDisplay($aArrayCombo)
    Next

    Click File -> Save and give it a name.

    Then press F5 to run it (or press F7 to create a .exe)

    Enter the number of events, eg 3
    Enter a name for each event, eg a, b, c

    It will show:
    a
    b
    c

    Press Escape

    It will show

    a, b
    a, c
    b, c

    Press Escape

    It will show

    a, b, c

    NiVZ
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.6K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.