User Tools

Site Tools


Sidebar

projects

wcp1 (due 20240124)
pct0 (bonus; due 20240125)
pct1 (bonus; due 20240125)
abc0 (due 20240131)
btt0 (due 20240131)
pct2 (due 20240131)
wcp2 (due 20240131)
mpg0 (due 20240207)
pct3 (bonus; due 20240207)
wcp3 (due 20240207)
mpg1 (due 20240214)
pct4 (due 20240214)
wcp4 (due 20240214)
bwp1 (bonus; due 20240228)
mpg2 (due 20240228)
pct5 (bonus; due 20240228)
wcp5 (due 20240228)
cgf0 (due 20240306)
gfo0 (due 20240306)
pct6 (due 20240306)
wcp6 (due 20240306)
cgf1 (due 20240313)
pct7 (bonus; due 20240313)
wcp7 (due 20240313)
cgf2 (due 20240320)
pct8 (due 20240320)
wcp8 (due 20240320)
pct9 (bonus; due 20240327)
wcp9 (due 20240327)
bwp2 (bonus; due 20240410)
cgf3 (due 20240410)
gfo1 (due 20240410)
pctA (due 20240410)
wcpA (due 20240410)
pctB (bonus; due 20240417)
waq0 (due 20240417)
wcpB (due 20240417)
pctC (due 20240424)
waq1 (due 20240424)
wcpC (due 20240424)
pctD (bonus; due 20240501)
wcpD (bonus; due 20240501)
gfo2 (due 20240508)
pctE (bonus; due 20240508)
wcpE (bonus; due 20240508)
EoCE (due 20240516)
haas:spring2024:data:projects:cgf1

Corning Community College

CSCS2320 Data Structures

PROJECT: Card Game Fun (CGF1)

OBJECTIVE

With the cards and various properties laid out, implement and use doubly-linked lists to arrange cards in a deck, or piles, foundations, as if setting the stage to make a card game.

EDIT

You will want to go here to edit and fill in the various sections of the document:

CGFX

STANDARD 52-CARD DECK

VALUES

A standard deck has 13 values on the face of the card:

  • Ten “Number Values”, starting at the Ace “A”, and going up to 10.
  • Three “Face Values”, which are the Jack, Queen, and King.
SUITES

A standard deck of playing cards are divided into four suits, which are also grouped into colors:

  • Red:
  • Diamonds
  • Hearts
  • Black:
  • Spades
  • Clubs

doubly linked stack

Reference: https://www.geeksforgeeks.org/introduction-to-stack-data-structure-and-algorithm-tutorials/

A doubly linked list is nearly similar to a singly linked list, as it is a list of structs, where each struct has a pointer to the next struct in the list.

However, in a doubly linked list, each struct also has a pointer which points to the last struct in the list. This means functions can be used to go back and forth through the list, instead of just going one way.

Stack Struct

A separate struct can be created specifically for the stack. This struct will need pointers to the structs being used for the cards and piles.

Another option is to initialize the stack using the pile struct. since the stack is it's own pile, it does not need to be in a list with other piles.

Function to Create Stack
struct Pile {
    // Other Data Needed for Pile
    Card* firstCard;
};
 
void main(void) {
 
    Pile* Stack = (Pile*)malloc(sizeof(Pile));
 
    // Set Stack to be Empty
    Stack->firstCard = NULL;
}

LIFO/FILO

LIFO and FILO are both used to describe a way to insert and retrieve data from a data structure.

LIFO stands for Last In First Out, which means the last element to be put into the data structure is the first to be retrieved. This is the main method for pushing and popping data from a stack.

FILO stands for First In Last Out, which is another term for the same process.

size: bounded vs unbounded

top

push

stack overflow

When pushing data to the stack, it is important to not push too much data onto the stack, as a stack overflow can occur.

In a stack overflow, there are so many elements pushed onto it, that the stack data starts overlapping with the program data in RAM, which can cause severe errors when the program then tries to read that data.

To solve this, make sure that whatever gets pushed to the stack gets popped at some point before moving on.

pop

stack underflow

peek

card game: freecell

Freecell is a Solitaire card game where the goal is to move piles of cards around in order to get each card to four “foundations”.

foundations

The foundations are where you need to get each card to by the end of the game in order to win.

Foundation logic

There are four foundations, each of them separated by suit. A card of any suit can go into any foundation, but once one suit is in a foundation, then only cards of that suit can go into only that foundation.

Foundations are also sorted by rank: to start a foundation, you need to place an Ace onto an empty foundation, then place the next value card of the same suit onto that Ace, and so on from Ace-King.

storage
tableau

The tableau is the main playing area of the game. This is where the various piles of cards get moved around in order to get to cards that can be moved to a foundation.

pile
 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any “to be implemented” comments MUST be removed
      • these “to be implemented” comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool by the deadline.

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/DESIG/PROJECT$ submit DESIG PROJECT file1 file2 file3 ... fileN

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

182:cgf1:final tally of results (182/182)
*:cgf1:doubly linked node implemented [39/39]
*:cgf1:doubly linked list implemented [39/39]
*:cgf1:doubly linked list utilized [39/39]
*:cgf1:functional card game of some sort [39/39]
*:cgf1:all project files submitted [26/26]

Pertaining to the collaborative authoring of project documentation

  • each class member is to participate in the contribution of relevant information and formatting of the documentation
    • minimal member contributions consist of:
      • near the class average edits (a value of at least four productive edits)
      • near the average class content change average (a value of at least 1024 bytes (absolute value of data content change))
      • no zero-sum commits (adding in one commit then later removing in its entirety for the sake of satisfying edit requirements)
    • adding and formatting data in an organized fashion, aiming to create an informative and readable document that anyone in the class can reference
    • content contributions will be factored into a documentation coefficient, a value multiplied against your actual project submission to influence the end result:
      • no contributions, co-efficient is 0.50
      • less than minimum contributions is 0.75
      • met minimum contribution threshold is 1.00

Additionally

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction
haas/spring2024/data/projects/cgf1.txt · Last modified: 2024/02/26 13:59 by 127.0.0.1