# VBForums CodeBank > Codebank - Game Programming >  Tri peaks card game in Excel

## Españolita

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  :Wink: 
trizip.zip

----------


## Hack

_Moved To Game Programming_

----------


## si_the_geek

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

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
                          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:


```
Asc(Mid(Ref, f, 1)) <= 57 And Asc(Mid(Ref, f, 1)) >= 48
```

with this:


```
IsNumeric(Mid(Ref, f, 1))
```

----------

