A project for COURSENAME by YOUR NAME OR GROUPMEMBER NAMES during the SEMESTER YEAR.
This project was begun on DATE and is anticipated to take X AMOUNT OF TIME. (Upon completion you can correct this with the actual length).
This project was supposed to be a final project, but Matt changed his mind…not sure if that's good or bad.
State the purpose of this project. What is the point of this project? What do we hope to accomplish by undertaking it?
In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
State the idea or purpose of the project. What are you attempting to pursue?
Upon approval, you'll want to fill this section out with more detailed background information. DO NOT JUST PROVIDE A LINK.
Providing any links to original source material, such as from a project page, is a good idea.
You'll want to give a general overview of what is going to be accomplished (for example, if your project is about installing a web server, do a little write-up on web servers. What is it, why do we need one, how does it work, etc.)
Give a general overview of your anticipated implementation of the project. Address any areas where you are making upfront assumptions or curtailing potential detail. State the focus you will be taking in implementation.
State and justify the attributes you'd like to receive upon successful approval and completion of this project.
The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project.
The first step was to become familiar with the rules and vocabulary for the 4 card games. Not only do I need to memorize C vocabulary, now I need to learn some Solitaire vocabulary (A glossary of solitaire terms can be found here):
1. "FreeCell":
2. "Forty Thieves":
3. "Eight Off":
4. "Baker's Game":
The next step is picking a game to actually code. My initial choice is “FreeCell” as it seems the easiest to code. Before you play a card game, you first need a deck. Since “FreeCell” uses only one standard deck, there is only a total of 52 cards used:
Black ♣ | Red ♦ | Red ♥ | Black ♠ |
---|---|---|---|
A♣ | A♦ | A♥ | A♠ |
02♣ | 02♦ | 02♥ | 02♠ |
03♣ | 03♦ | 03♥ | 03♠ |
04♣ | 04♦ | 04♥ | 04♠ |
05♣ | 05♦ | 05♥ | 05♠ |
06♣ | 06♦ | 06♥ | 06♠ |
07♣ | 07♦ | 07♥ | 07♠ |
08♣ | 08♦ | 08♥ | 08♠ |
09♣ | 09♦ | 09♥ | 09♠ |
10♣ | 10♦ | 10♥ | 10♠ |
J♣ | J♦ | J♥ | J♠ |
Q♣ | Q♦ | Q♥ | Q♠ |
K♣ | K♦ | K♥ | K♠ |
To “shuffle” the deck, first load the suite into a Doubly Linked List. Then use the rand() C function to pick a random node. The node is pushed onto the deck stack and removed from the list (Black ♣ will be nodes 1 - 13, Red ♦ will be nodes 14 - 26, Red ♥ will be nodes 27 - 39, Black ♠ will be nodes 40 - 52). This process is repeated until the Doubly Linked List is empty then the entire deck can be dealt.
I MIGHT (time permitting) try to implement an “easter egg”. In the HIGHLY UNLIKELY (but possible) event that the card combination in the 4 foundations is '8♠ A♣ A♠ 8♣' (the "Dead Man's Hand" in Poker); the program will exit and print the message “BANG! You're Dead. You got the Dead Man's Hand.”.
/* * hello.c - A sample "Hello, World!" program * * written by NAME for COURSE on DATE * * compile with: * gcc -o hello hello.c * * execute with: * ./hello */ #include <stdio.h> int main() { printf("Hello, World!\n"); // Output message to STDOUT return(0); }
Again, if there is associated code with the project, and you haven't already indicated how to run it, provide a sample run of your code:
lab46:~/$ ./helloworld Hello, World! lab46:~/$
Comments/thoughts generated through performing the project, observations made, analysis rendered, conclusions wrought. What did you learn from doing this project?
One thing I learned was that there are unsolvable games for FreeCell. Another idea that I had was writing a game of chess (or Suicide Chess) for the next semester instead of a FreeCell game.
In performing this project, the following resources were referenced:
/* Set the background and text color to look like a playing card: Background will be white, cards red and black, and a "reset" to remove the colors. */ #define RST "\033[0m" /* Reset the color */ #define WHT "\033[37m" /* White */ #define BLK "\033[30m" /* Black */ #define RED "\033[31m" /* Red */ /* Display Unicode symbols for suits. 'wchar_t' prints a wide character; required to display Unicode Symbols. */ wchar_t cardSuits[] = L"♣♦♥♠", cardNums[] = L"A23456789TJQK"; // Change the background to WHT. // Not sure how I can do this yet. // Print the BLACK "card" then "reset" the color to print RED. printf(BLK "BLK card\n" RESET); printf(RED "RED card.\n" RESET);