Thread: Sign up: The Card Game Contest

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490

    Sign up: The Card Game Contest

    Topic: Solitaire Solver
    Directions: Create a game which intelligently plays Solitaire.

    There will not simply be an array of cards to choose from, because that would make cheating very easy. There will be arrays of cards, showing only the ones that are facing up. (The ones facing down are invisible to the programmer.)

    card_array[0][0] might contain the card on the top of pile 1. card_array[1][1] might contain the second card down from the top of pile 2.

    So it's: int card_array[pile][card in pile going from top downward]

    Piles 0-6 will be the normal solitaire piles. Piles 7-10 will be the ones on the top where you put them last. Pile 11 will be the discard pile, which would show the card just served off the deck. All piles are read from left to right. Cards 0-12 are diamonds, the next 13 are hearts, the next 13 are clubs, and the last 13 are spades. (So, red cards are 0-25, the black cards are 26-51). This is a global variable. (I would've made it local, but that's too much work for something like this.) If a card turns up -1, that means that card does not exist, and you've probably gone to the end of that pile. (If the first card in a pile is -1, that means that pile is empty.)

    Some functions:
    int new_card(void);
    This function takes a card from the serving pile (I forget the technical name) and places it in the discard pile. You can assume that each time it's only one card this is happening to. The value returned will be either the value of the card returned (cards are valued 0 to 51) or -1 if it has reached the end of the pile. It will automatically reset if it's at the end of the pile.

    int move_card(pile number card is in, pile number card is moved to, number of cards moved);
    This returns a 1 if successful, and a 0 for failure. Reasons for failure include breaking the rules or incorrect pile numbers.

    Any possible functions i missed?

    Your (the contestant's) function will be called:
    int make_best_choice(void);
    Inside it you will move cards, draw new cards, and basicly interact with the game so that you win. You are encouraged to use all the resources at your disposal to win, but it's impossible to peek. You can count cards that have already gone by, if you want to factor it into your decision.

    After deciding the right move the program should call the move function. Then everything is automatically updated and you go through the process again until you win or lose.

    It's up to your program to decide whether or not to lose. A winning scenario is easy to spot, but a losing scenario requires that you concede defeat yourself. Return a 0 for a defeat, and a 1 for a win.
    Criteria:
    efficiency -- use computer resources efficiently
    elegance -- make your code neat and understandable. The structure and planning put into your program is key
    portability -- how many computers can your code compile across? (especially important, cause i got to link with the code)
    Special Criteria:
    Interface -- make your interface user-friendly and idiot-proof
    Success rate/Intelligence -- Does this game win more often than normal?
    Stability/Garbage Collection -- does your game clean up after itself? (ie: memory leaks?) when will it crash? how stable is it?

    Time Limit: For this one i'll be generous and say that all entries need to be in by September 24.

    Signed up Contestants: 8 slots left
    vasanth
    troll king

    Signed up Judges: all slots filled
    ygfperson
    civix
    xds4xl
    klinerr1

    Send all entries to [email protected] or [email protected]
    You can also submit your entry at the web site, contests.cprogramming.com

    Have fun! To join in just reply to this thread.

    Remember, above all, make sure your program works.

  2. #2
    Seven years? civix's Avatar
    Join Date
    Jul 2002
    Posts
    605
    I'd be more than happy to judge, if you didnt have a problem with that, ygf.
    .

  3. #3
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Id also like to judge .
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  4. #4
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    Question

    only C or C++ programs allowed ?
    Never end on learning~

  5. #5
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Im not going to answer you because the answer is obvious.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  6. #6
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Sign me up.. I am in....

  7. #7
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    only C or C++ programs allowed ?
    yep.

  8. #8
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by ygfperson
    only C or C++ programs allowed ?

    yep.
    What, I can't enter my REXX version then? Goddammit, ygf, I've been coding that for ages too.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  9. #9
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    games must restrict the player(s) to a
    ?

  10. #10
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Congradulations. You found my momentary lapse of reason.

    What I mean is that all players must be restricted in their movement and playing so they can't break the rules of the game.

  11. #11
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: Sign up: The Card Game Contest

    Originally posted by ygfperson
    Write a card game program. The card game can be any reasonable game (not 52-pickup).
    what is 52-pickup??????
    hello, internet!

  12. #12
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >what is 52-pickup??????
    You never played 52 card pickup ? wow! It's an school trick, you get someone to agree to play it, then just throw the deck of cards in the air, and watch the poor sod pick up all the cards. If they refuse, they get the raps, or they did in my days at school. I suppose you've never heard of the raps either?!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  13. #13
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    the web page has been updated with the same info as is on here. soon i'll add file-uploading support.

  14. #14
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    File-Uploading support has been integrated. Just surf to the contest web page, click on the right link, and don't forget to include your name.

  15. #15
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Yes that is waht i have been trying to say all these days.. Make the contest more specialized and not general so no onee can copy the cource...... I had recomended a function contest for specoialized problems.. So rethink the contest idea... TO submit a contest that has been happening all these time it just requires 10 minutes.. Go to a site download a source submit it... No idea how many have done it...

    I am also off this contest if the idea remains same...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise Unwanted Output
    By pobri19 in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2008, 04:07 AM
  2. my upcoming UNO card game :)
    By Hussain Hani in forum Game Programming
    Replies: 5
    Last Post: 01-24-2008, 01:19 AM
  3. Card game help
    By aaroroge in forum Game Programming
    Replies: 9
    Last Post: 07-16-2005, 06:37 PM
  4. Sign Up -- The Next Contest
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 49
    Last Post: 06-26-2002, 06:09 PM
  5. Sign up -- Contest Thread
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 70
    Last Post: 05-27-2002, 06:46 PM