Appendix C

Source for the Solitaire Game

This appendix contains the complete source for the solitaire game described in Chapter 9. This program is written in C# and uses the standard Windows run-time library.

namespace csSolitaire
{
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.WinForms;
    using System.Data;

public enum Suits { Spade, Diamond, Club, Heart };

//
// PlayingCard
//

public class PlayingCard
{
  public PlayingCard (Suits sv, int rv)
    { s = sv; r = rv; faceUp = false; }

 public bool isFaceUp { get { return faceUp; } } public void flip () } faceUp = ! faceUp; } public int rank { get { return r; } } public Suits suit { get { return s; } } public Color ...

Get An Introduction to Object-Oriented Programming, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.