Results 1 to 3 of 3

Thread: Tri peaks card game in Excel

  1. #1

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

    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
    trizip.zip
    Last edited by Españolita; Apr 30th, 2014 at 01:05 AM. Reason: The link disappeared so re-added

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Tri peaks card game in Excel

    Moved To Game Programming

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

    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:
    Code:
            Case 5, 4, 3    'Bottom/second/third row of layout
    alternative syntax using a range:
    Code:
            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:
    Code:
            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
                              cmdShuffle_Click
                          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:
    Code:
    Asc(Mid(Ref, f, 1)) <= 57 And Asc(Mid(Ref, f, 1)) >= 48
    with this:
    Code:
    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