Giter Club home page Giter Club logo

c-minesweeper's Introduction

Welcome, my name is Cameron!

I'm a computer science student at the University of Georgia! Go Dawgs!

I'm the MOCI Chief Engineer at UGA's Small Satellite Research Lab.


I like challenging myself with new projects either big or small. My coding projects tend to be for the challenge, to learn a new library, or just to have fun with some friends.

c-minesweeper's People

Contributors

cbonesteel avatar

Watchers

 avatar

c-minesweeper's Issues

TODO: Make reveal function

// TODO: Make this do something to actually reveal

// TODO: Add Implementation

Reveal should either reveal the number of mines adjacent to a tile or end the game if a mine is revealed. Valid input and mine finding should be handled in the command_processor. Only if the input is valid and there is no mine present should the board reveal be called, as that will only place the number of adjacent mines onto the board.

TODO: Make flag function

// TODO: Add Implementation

The flag function in board already places a flag on the game board. The command_processor needs to be implemented to check for good bounds, as well as checking if a mine exists on the space. If a mine does exist there, the mines_left variable in board needs to be decremented. mines_left needs to be added to the struct and initialized in the board builder.

TODO: Change Main to include one method

c-minesweeper/src/main.c

Lines 24 to 25 in 75ab4fe

// TODO: Move Much of this to helper methods
// main should contain one call to a run function

As it stands in 0.1.0, the menu is hand made in the main function. This needs to be changed to only have one single function call in main and otherwise rely on helper methods to run the game.

No Fog Bug

while (!game__get_end(game)) {
if (board__get_no_fog(&game->board) == true) {
board__print_no_fog(&game->board);
} else {
board__print_board(&game->board);
} // if

When an invalid command is initially entered, noFog appears to turn on. It currently stays on but this is a quick fix that I didn't implement initially. Understanding why noFog turns on when an invalid command is entered and why an error message is not printed is important to fix.

Reveal in Board not replacing properly

bool board__reveal(int x, int y, struct Board *board) {
if (board->reveal_pointer[x][y] == false) {
board->board_pointer[x][y] = board__count_num_adjacent(x, y, board);
board->reveal_pointer[x][y] = true;
// TODO: Make Recursive Reveal if Needed
return true;
} else {
return false;
} // if
} // board__reveal

This function appears to not replace the '*' character with the appropriate number of adjacent mines. This causes nothing to print when the board is printed.

Array Build Error

for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
printf("%d, %d\n", i, j);
board->board_pointer[i][j] = '*';
printf("%s\n", &board->board_pointer[i][j]);
} // for
} // for

This section of the code appears to be creating issues with duplicating chars. Early defined spots have extra chars added and it slowly reduces.

printf("%s\n", &board->board_pointer[0][0]);

This line is for debug and needs to be removed.

TODO: Game Board Building

// TODO: Take input for board size
game->noFog = false;
game->won = false;
board__build_array(10, 10, &game->board);
// TODO: Place mines based on settings

Add automatic mine spawning on board. (Milestone 0.1). Add option to input custom board size (Milestone 0.4).

README Doc Issue

Versions are behind for how to play and the welcome screen in the readme

TODO: Game Design Finalization

This will be a place to list all lines that need to be changed during the finalization of the game's design, ie. how it looks when used in the terminal.

printf("x is out of bounds\n"); // TODO: Change when game design is finalized

printf("y is out of bounds\n"); // TODO: Change when game design is finalized

printf("Invalid Command\n"); // TODO: Change when game design is finalized

game.h include issue

// #include "command_processor.h"

For some reason, when this include statement is uncommented, it causes major compilation errors in command_processor.c. Dual dependency may be causing this, ie. game and command_processor rely on each other. Might be gcc flag fix in Makefile.

TODO: Make this do something to actually reveal

// TODO: Make this do something to actually reveal
board->board_pointer[x][y] = 1;

This function currently only sets revealed spaces to 1. This section will need to be changed to facilitate finding adjacent mines and/or revealing a mine. This should not handle recursive reveals, ie. when a space with 0 adjacent mines is revealed, this function will not reveal all adjacent tiles itself. game__reveal() should handle this action.

TODO: Implement No Fog

// TODO: Add Implementation

The no fog function is meant to help with debugging. It will remain in the game as a cheat command but will not appear in the help section. The entire function needs to be implemented as there is currently no way to use it. The no fog function will reveal all mines on the board for 1 turn.

Milestone 0.1 Menu Bug

c-minesweeper/src/main.c

Lines 26 to 37 in 75ab4fe

menu__print_welcome();
printf("\nStart New Game? Y/N: ");
fgets(input, 1, stdin);
if (strncmp(input, "N", 1) == 0 || strncmp(input, "n", 1) == 0) {
return 0;
} else {
game__build_game(&game);
game__play(&game);
} // if

For this initial milestone, a simple menu that asks if a game wants to be started should be displayed. For some reason, input is being skipped on this menu and the first iteration of the board is being printed immediately after the question.

Board Print Issue

printf("%c ", board.board_pointer[i][j]);

This line does not work for what I want to accomplish. It will not print both chars and ints for some reason, leaving an empty spot when a spot is revealed and a number is added.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.