Day 74/100  100 Days of code

Day 74/100 100 Days of code

Codewars/Jumping Ball

I created a new Github repo and divided the project into two parts. The first part runs a secondary program and reads the results from a CSV file. Then, the main application simulates these results using SDL. The second program now exists as a submodule in the repository of the first program. Managing each part should be easier now.

I created a new main.c file to replace the old main.cpp file and filled it with the necessary code.

#include <stdio.h>
#include <errno.h>
#include <stdlib.h>

int main(void)
    int getCalcFile = system("test -f ../jumpcalculations/app/output/calculations.csv");
    printf("%d\n", getCalcFile);

    if (getCalcFile == 0)
        getCalcFile = system("cd ../jumpcalculations/app/output && rm calculations.csv");

        if (getCalcFile != 0)
            printf("Calculations CSV removal failed\n, %d", errno);

    // Execute Simulation

    return EXIT_FAILURE;

I updated the CMakeLists.txt to create a program using the main.c source file. I should update the CMakeLists with the desired version of C.

cmake_minimum_required(VERSION 3.27)
project("JumpingBall" LANGUAGES C VERSION 0.1 DESCRIPTION "Jumping Ball Physics Simulator")

add_executable(${PROJECT_NAME} ./src/main.c)

I solved two Codewars problems that were quite easy. The first one involved a grade book, and the other required summing the numbers in an array.