jinc0930 / Clue

A game
2 stars 0 forks source link

Allow fearless implementation of new things #46

Closed mishimalisa closed 1 year ago

mishimalisa commented 1 year ago

This pull request is a refactor for making the life easier for future implementations. Although this includes a new folder to enable graphics. Is just optional. Everything works the same. Type make and ./clue and play the terminal version. Like before.

Before approving this, please review all the code in the files changed tab and comment the code lines if necessary.

Main Changes

  1. Now the logic from the adventure.c was moved to a new file called game.c
  2. Removed all the debug mess in favor of tests.c
  3. I created a lot of tests for the game logic: make test && ./test
  4. The graphics is introduced but incomplete and it's inside a separate folder. To compile type: make graphics and ./clue

The new game state

https://github.com/jinc0930/Clue/blob/a974e9e9220f92b26cae83eddd3bbe2fb58514f4/game.h#L13-L26

A single test case for demo

https://github.com/jinc0930/Clue/blob/a974e9e9220f92b26cae83eddd3bbe2fb58514f4/tests/test.c#L90-L97

Make commands

  1. Compile and run tests: make test && ./test
  2. Compile and run terminal: make && ./clue
  3. Compile and run graphical: make graphics && ./clue

Graphical progress is being tracked here

mishimalisa commented 1 year ago

Hey, I recommend squashing and merging

image