Corning Community College
Data Structures
Project: Card Game Implementation
To gain an understanding of pointer-based dynamic data structures and their use in algorithms.
The intent of this project is to explore the use of pointer-based dynamic data structures through the implementation of a specified card game.
Your task (either individually or in groups), is to implement a specific card game in a particular language. I am going to require diversity amongst card games implemented and programming languages used. So whatever path you decide to embark upon, I must be made aware and approve.
You must:
The following are approved games that you may implement for this project (choose one):
The reason I have chosen these games is that they involve a level of memory allocation, which has similarity to how the actual computer's hardware works. There may be additional games that fall under this category. If you find one and would like to implement it, let me know and I can ascertain if it is appropriate.
Technically I'd allow any language that allows for linked data structures; but the above four are the most common students at CCC are likely to have encountered.
A caveat, I am only officially supporting C and C++, as those are the languages I will be using in class (predominantly C).
Borrowed from Wikipedia:
A card game is an excellent example of stack usage. When moving cards, I want to see push/pop operations taking place with respect to the various “storage locations” the cards can reside (foundations, cells, etc.)
To better understand the impact of stacks on these card games, be sure to play some games. Once you are familiar with the rules, specifically take notice of the functionality the stacks enable for the playing of the game.
To facilitate the readability of your code, when preparing your code for submission, I'd like for you to make sure certain qualifications are met:
If you'd like, I have configured a facility on Lab46 to enable you to conveniently beautify your code to the ANSI/Allman style of coding. This is my preferred coding style, and would help me to better read your code.
So, if you aren't already consistent at code formatting (some have well-established coding habits and their code, although styled slightly different than mine, is still far more readable because it is consistent), please go through the following exercise for all your source files.
In this example, I will assume your files are called: main.c, list.c, and freecell.h
lab46:~$ cd src/cardgame lab46:~/src/cardgame$ indent main.c lab46:~/src/cardgame$ indent list.c lab46:~/src/cardgame$ indent freecell.h lab46:~/src/cardgame$
You will find that a backup of your original formatted source code is saved in files called main.c~, list.c~, and freecell.h~. But the plain .c files are now nicely formatted.
If you find yourself tracking down elusive bugs and have experienced an unbalanced curly brace… you may want to consider passing your code through indent so as to save yourself some work and time. You'd be amazed what a little code beautification will do for you.