INDAPlus21 / INDAPlus21/carlch-simulation

Pass

Open
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Well done bae!

Only, system("clear") doesn't execute in the Windows Command Prompt. The application works, with less grace, without this statement.

Once again I fail to compile and execute your application locally. Please include instruction! I tried to link SDL2, but am too bad.

Tried to follow this tutorial with the following build commands:

  • gcc main.c -I/SDL2/include -F/ -framework SDL2 -o main
  • gcc main.c -I/SDL2/include -L/SDL2/lib -Wall -lmingw32 -lSDL2main -lSDL2 -o main

Here are some notes on your code:

Excessive Branching

I'm gonna give up soon.

Your code:

void
evolve(int* a) {
  //...
  XY_FOR {
    //...
    for(/*...*/) 
    for(/*...*/) {
      //...
      if(x % 5 == 0 && i == x - 1) continue;
      if(x % 5 == 4 && i == x + 1) continue;
      if((i == x && j == y) || a[neighbour] == DEAD) continue;
      n++;
    }
    //...
  }
  //...
}

Less branching:

void
evolve(int* a) {
  //...
  XY_FOR {
    //...
    for(/*...*/) 
    for(/*...*/) {
      //...
      if(!(x % 5 == 0 && i == x - 1) &&
         !(x % 5 == 4 && i == x + 1) &&
         !((i == x && j == y) || a[neighbour] == DEAD)) n++;
    }
    //...
  }
  //...
}
Spagetti

Yes, as you told.

Unused variables:

void 
SquareAddVelocity(Square *s, int x, int y, float amountX, float amountY) {
  int N = s->size;
  //...
}

void
renderD(Square* s, SDL_Renderer* gRenderer) {
  //...
  for(/*...*/)
    for(/*...*/) {
      float x = i * 1;
      float y = j * 1;
      //...
    }
}

Keep it up!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in main.c, reviewing system("clear"), evolve, SquareAddVelocity, and renderD alongside the existing SDL2 build commands. Done means Windows can run without the clear command, the unused variables and highlighted branching are addressed, and build instructions are included for local compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, desktop, documentation
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.