467,145 Members | 983 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

begging for a big help

how to make solitaire game of win xp with c++?

the game should be in this way:

1:deal:to begin the game 28 cards are dealt into seven piles the
leftmost pile has one card the next tow cards and so forth up
tp seven
cards in the rightmost pile only the upermost card of each of
the
seven piles is turnd face up.
2:on the topmost face-up card of each pile you may build in
descending
sequences red on black or black on red
3:all face-up cards on a pile are movde as a unit and may be placed
on
another pile according to the bottommost face-up card.
4:if the one pile remove completely a face-up king may be move from
a
pile (together with all cards above it)or the top of thewaste
pile in
to vacated space.
5:cards are added to output piles in sequence.
6:from the rest of the deck called the stock cards are turned up
one
by one and placed faced-up on the waste pile.you may always
play cards
off the top of the waste pile but only one at a time.

Dec 10 '06 #1
  • viewed: 1228
Share:
2 Replies

sh*********@gmail.com wrote:
how to make solitaire game of win xp with c++?

the game should be in this way:

1:deal:to begin the game 28 cards are dealt into seven piles the
leftmost pile has one card the next tow cards and so forth up
tp seven
cards in the rightmost pile only the upermost card of each of
the
seven piles is turnd face up.
2:on the topmost face-up card of each pile you may build in
descending
sequences red on black or black on red
3:all face-up cards on a pile are movde as a unit and may be placed
on
another pile according to the bottommost face-up card.
4:if the one pile remove completely a face-up king may be move from
a
pile (together with all cards above it)or the top of thewaste
pile in
to vacated space.
5:cards are added to output piles in sequence.
6:from the rest of the deck called the stock cards are turned up
one
by one and placed faced-up on the waste pile.you may always
play cards
off the top of the waste pile but only one at a time.
Start with

int main()
{
// Your solitaire code goes here
}

Have you read the FAQ? This one explains how to get help with code you
are having trouble with.
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

Gavin Deane

Dec 10 '06 #2
<sh*********@gmail.comwrote:

<skip to end>
how to make solitaire game of win xp with c++?

the game should be in this way:

1:deal:to begin the game 28 cards are dealt into seven piles the
leftmost pile has one card the next tow cards and so forth up
tp seven
cards in the rightmost pile only the upermost card of each of
the
seven piles is turnd face up.
2:on the topmost face-up card of each pile you may build in
descending
sequences red on black or black on red
3:all face-up cards on a pile are movde as a unit and may be placed
on
another pile according to the bottommost face-up card.
4:if the one pile remove completely a face-up king may be move from
a
pile (together with all cards above it)or the top of thewaste
pile in
to vacated space.
5:cards are added to output piles in sequence.
6:from the rest of the deck called the stock cards are turned up
one
by one and placed faced-up on the waste pile.you may always
play cards
off the top of the waste pile but only one at a time.
I am going to assume this is a variant of the game known as Klondike, I
don't feel like searching through the rules to see of that is so.

This is not a trivial thing you can crank out in an hour or two. If you
have a white board, use it. Expect to make mistakes, perhaps meet dead
ends and have to go back and redo earlier work. I presume you are expected
to use the STL, especially vector and list to a considerable extent. Start
by getting a way to represent a card, my first guess would be a struct.
Note that the game is based largely on "red/black" distinctions, rather than
the suit. Write a class (or two) to create a deck and shuffle the
cards.Write a class that will create a tableau, q.v. Note that there will be
three kinds of card, face down, face up, and topmost (the one visible) card.
There will also be an empty pile. Perhaps you will want a "pile" class.
The class should be able to answer questions such as "what is the displayed
card"? Remember there may not *be* a card. So perhaps you invent the notion
of a "null card" and make that a valid card identifier. Think in terms of
seven to a dozen classes and one or two structures, that should be in the
ball park.

If you can't figure out to use some STL thing, write a separate little
throwaway test program to see how to use it. The STL is written for a
professional programmer and great generality, you will most likely find this
a hindrance rather than a help.

Compile often, remember that just because you compile it does not
necessarily follow that you can run the program and get any meaningful
results. Don't spend lot of time typing making a "cute" user interface,
cuteness tends to attract a beginner, it defers the time when you must dig
in and do the hard part. Don't sit back and expect much help, I am quite
sure that no one will send you a working program. So start making notes
and write some code.

Dec 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by wukexin | last post: by
3 posts views Thread by Colin J. Williams | last post: by
7 posts views Thread by Corepaul | last post: by
6 posts views Thread by Jax | last post: by
5 posts views Thread by Steve | last post: by
3 posts views Thread by The Eternal Squire | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.