Results 1 to 3 of 3
  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2007
    West Yorkshire, UK

    Tri peaks card game in Excel

    This is a little thing I'm putting out there just for a bit of fun. There are many areas where it can be improved, like automatically saving when a new high score is achieved and preventing it always asking if you want to save changes when you exit.
    If anyone wants to play with it and improve it, feel free to do so.
    Oh, by the way, I hope you enjoy it
    Last edited by Españolita; Apr 30th, 2014 at 01:05 AM. Reason: The link disappeared so re-added

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Searching for mendhak

    Re: Tri peaks card game in Excel

    Moved To Game Programming
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Bristol, UK

    Re: Tri peaks card game in Excel

    That's a very good implementation of the game - nice job!

    The only minor complaint I have is that the score disappears as soon as the game is finished, it would be nicer if it stayed (but perhaps in a different colour) until a new game is started.

    In terms of the code there are a few bits that can be shortened/simplified, one of which is the repetition of code in Clicked. The code for rows 3,4,5 are identical, so rather than have a Case for each one you could use a single case for all three, eg:
            Case 5, 4, 3    'Bottom/second/third row of layout
    alternative syntax using a range:
            Case 3 to 5    'Third/second/bottom row of layout
    As most of the code is also identical for row 2, you could even merge them all, like this:
            Case 2 To 5      'layout
                CellRef = Xlate(Target.Column, Target.Row)
                        Range(CellRef).Interior.ColorIndex = 10
                        If Target.Row = 2 Then   'Top row of layout
                          Finished = Finished + 1
                          If Finished = 3 Then 'All 3 cards at the top of the peaks used
                              Score = Score + (Unused - 11) 'Bonus based on no of cards unused
                              [A3] = Score
                              [K7] = ""
                              Range("K7").Interior.ColorIndex = 10
                          End If
                        Else                     'other rows
                          CheckOpening (CellRef)
                        End If
                    End If
                End If

    Most of the routines in Module11 aren't really needed, as there are already equivalents built in (which should be faster than yours), eg:
    ToUpper: UCase
    ToLower: LCase
    StringSearch: InStr
    Replace: Replace (but slightly different behaviour to your version, so probably not apt).

    FindNumber and FindLetter can be simplified slightly by replacing this:
    Asc(Mid(Ref, f, 1)) <= 57 And Asc(Mid(Ref, f, 1)) >= 48
    with this:
    IsNumeric(Mid(Ref, f, 1))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.