Skip to content

Practical work repository for the Programming Topics subject (C language) at the National University of La Matanza (@unlam).

License

Notifications You must be signed in to change notification settings

hozlucas28/C-Practical-Work-2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Practical Work [2024]

Repository for the practical work of the Programming Topics course - UNLaM (National University of La Matanza).

Summary • Features • Installation • Known Issues • Application Structure •
Team Workflow • Development Team • Additional Material • License • Acknowledgments

Preview

(demonstration video)

Summary

This repository contains the practical work for the Programming Topics course at the National University of La Matanza (UNLaM). The practical work involves the development of Conway's Game of Life using the C programming language and the Simple DirectMedia Layer (SDL) library for the graphical interface.

Features

  • Architecture planning
  • Code conventions and standards
  • Code documentation using Doxygen syntax
  • Commits following the Conventional Commits
  • Continuous integration with GitHub Actions
  • Deployment of releases
  • Dynamic memory
  • File reading and interpretation
  • Implementation of program arguments
  • Implementation of the Simple DirectMedia Layer (SDL) library
  • Input control using validations
  • Responsive design
  • Team Workflow planning (branches, tags, and releases)

Installation

  1. Clone the repository to your device and install the CodeBlocks IDE with MinGW.

  2. Open the files src.cbp (main project) and libs.cbp (library project) with the CodeBlocks application. These files are located within the cloned repository.

  3. Select the libs.cbp project (library project) and compile it in Release mode and Debug mode.

  4. Select the src.cbp project (main project) and run it in Release mode to enjoy Conway's Game of Life.

Program arguments

Argument Description Accepted value(s) Default value Example
--dashboard-rows Number of rows for the dashboard. int (0, default value] (<SCREEN HEIGHT RESOLUTION> / 10) * 0.93 --dashboard-rows=28
--dashboard-cols Number of columns for the dashboard. int (0, default value] (<SCREEN WIDTH RESOLUTION> / 10) * 0.99 --dashboard-cols=55
--pattern Pattern to draw in the center of the dashboard. "glider", "toad", "press" or "glider cannon" "" --pattern="glider cannon"
--maximum-generation Maximum number of generations. int (a value less than 0 means infinite generations) 0 --maximum-generation=-1
--delay Delay to generate the next generation. int [0, 1000] 0 --delay=50
--platform Platform where the dashboard will be rendered. "console" or "sdl" "" --platform="sdl"
--initial-state-file Path to a file with the initial state of the dashboard. Any path to a file with a .txt or .csv extension "" --initial-state-file="./statics/initial-state.csv"

How do I define the program arguments? (optional).

Important

All arguments (except for --dashboard-rows, --dashboard-cols, and --initial-state-file) will be requested via the console if not defined or accepted. Additionally, the --pattern parameter will be ignored if a valid --initial-state-file is provided.

Warning

The content of the file targeted by the --initial-state-file parameter must follow a specific format, as seen in the file initial-state.csv.

Known issues

Issue Solution
src.cbp (main project) doesn't compile Select the libs.cbp project (library project) and compile it in Release mode and Debug mode. Then, select the src.cbp project (main project), right-click on it, choose Build Options, and go to the Linker settings tab. There, add the libs.a files located in the libs/bin/Debug and libs/bin/Release folders. Finally, try compiling the main project again.

Application structure

C-Practical-Work-2024/
│
├── .github/
│   ├── statics/
│   │   ├── demo.mp4
│   │   ├── illustration-01.png
│   │   ├── illustration-02.png
│   │   └── preview.png
│   │
│   ├── translations/
│   │   ├── en/
│   │   │   ├── documentation.md
│   │   │   └── requirements.md
│   │   │
│   │   └── es/
│   │       ├── README.md
│   │       ├── documentation.md
│   │       └── requirements.md
│   │
│   └── workflows/
│       ├── format-code-on-pr.yml
│       └── format-code.yml
|
├── libs/
│   ├── libs.cbp
│   ├── macros.h
│   ├── main.h
│   ├── utilities.c
│   ├── utilities.h
│   ├── validators.c
│   ├── validators.h
|   |
│   ├── game/
|   |   ├── macros.h
|   |   ├── main.h
|   |   ├── methods.c
|   |   ├── methods.h
|   |   └── structs.h
|   |
│   └── patterns/
│       ├── constructors.c
│       ├── constructors.h
│       ├── macros.h
│       ├── main.h
│       ├── methods.c
│       ├── methods.h
│       └── structs.h
│
├── src/
│   ├── macros.h
│   ├── main.c
│   ├── src.cbp
│   ├── structs.h
│   ├── utilities.c
│   ├── utilities.h
│   ├── validators.c
│   ├── validators.h
│   │
│   ├── sdl/
│   │   ├── main.h
│   │   ├── methods.c
│   │   ├── methods.h
│   │   │
│   │   └── SDL2/
│   │       └── ( ... )
│   │
│   └── statics/
│       └── initial-state.csv
|
├── .clang-format
├── .gitignore
├── LICENSE
└── README.md
  • .github - Files related to the application's documentation and continuous integration.

    • statics - Static files (images, videos, diagrams, etc.).
    • translations - Translations of .md (Markdown) files.
    • workflows - GitHub Actions workflows.
  • libs - Project containing the libraries necessary for the execution of the main application project.

    • libs.cbp - Project configuration file.

    • macros.h - File with essential project macros.

    • main.h - File indexing all .h files of the project.

    • utilities.c - File with the implementation of the function prototypes found in utilities.h.

    • utilities.h - File with common function prototypes.

    • validators.c - File with the implementation of the function prototypes found in validators.h.

    • validators.h - File with functions prototypes related to validation process.

    • game - Functions and structures to create and interact with Conway's Game of Life.

      • macros.h - File containing macros.
      • main.h - File that indexes all .h files within the games folder.
      • methods.c - File containing the implementation of the function prototypes found in methods.h.
      • methods.h - File containing the function prototypes related to Conway's Game of Life methods.
      • structs.h - File containing structures.
    • patterns - Functions and structures for create patterns with cells.

      • constructors.c - File with the implementation of the function prototypes found in constructors.h.
      • constructors.h - File with function prototypes related to patterns creation.
      • macros.h - File with macros.
      • main.h - File indexing all .h files inside patterns folder.
      • methods.c - File with the implementation of the function prototypes found in methods.h.
      • methods.h - File with function prototypes related to pattern methods.
      • structs.h - File with structs.
  • src - Main project of the application.

    • macros.h - File with the project's main macros.

    • main.c - Main execution file.

    • src.cbp - Project configuration file.

    • structs.h - File with the main structures for configuring the project.

    • utilities.c - File with the implementation of the function prototypes found in utilities.h.

    • utilities.h - File with the function prototypes for configuring the project.

    • validators.c - File with the implementation of the function prototypes found in utilities.h.

    • validators.h - File with the function prototypes for validating the project's arguments.

    • sdl - Functions for interacting with the SDL2 library.

      • SDL2 - SDL2 library.

      • main.h - File indexing all .h files inside sdl folder.

      • methods.c - File with the implementation of the function prototypes found in methods.h.

      • methods.h - File with the function prototypes to interact with the SDL2 library.

    • statics - Files (images, videos, diagrams, etc.).

  • .clang-format - Configuration file for the clang-format code formatting tool.

  • .gitignore - Git configuration file to avoid tracking unwanted files.

  • LICENSE - Project license.

  • README.md - Markdown file with the general documentation for the application and repository.

Team workflow

%%{init: { 'logLevel': 'debug', 'theme': 'dark', 'gitGraph': {'showBranches': true, 'showCommitLabel': true, 'mainBranchName': 'Master', 'parallelCommits': true}} }%%
    gitGraph:
        commit
        commit tag: "v0.0.1"
        branch develop
        branch "Giannotti Tiago"
        commit
        commit
        checkout develop
        branch "Hoz Lucas"
        commit
        commit
        checkout develop
        branch "Huergo Estefania"
        commit
        commit
        checkout develop
        branch "Linares Guido"
        commit
        commit
        checkout develop
        branch "Quiroga Ferney"
        commit
        commit
        checkout develop
        merge "Hoz Lucas"
        merge "Giannotti Tiago"
        merge "Huergo Estefania"
        merge "Quiroga Ferney"
        merge "Linares Guido"
        checkout Master
        merge develop tag: "v1.0.0"
Loading

Tags

  • vMAJOR.MINOR.PATCH: This tag indicates a release of the practical work following Semantic Versioning, and will only be present in the Master branch commits.

Branches

  • Master: Branch containing stable versions of the practical work.

  • develop: Branch containing the development versions of the practical work, where team members will introduce new changes (commits).

The other branches are fictional and represent individual contributions from each member to the develop branch.

Development team

Additional material

License

This repository is under the MIT License. For more information about what is permitted with the contents of this repository, visit choosealicense.com.

Acknowledgments

We would like to thank the teachers from the UNLaM Programming course for their support and guidance.