You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
996 B
C
43 lines
996 B
C
/*
|
|
* spielfeld.h
|
|
*
|
|
* Created on: Mar 5, 2024
|
|
* Author: nicon
|
|
*/
|
|
|
|
#ifndef INC_SPIELFELD_H_
|
|
#define INC_SPIELFELD_H_
|
|
|
|
#include "main.h"
|
|
#include "uart.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <ctype.h>
|
|
|
|
extern UART_HandleTypeDef huart2;
|
|
extern RNG_HandleTypeDef hrng;
|
|
|
|
|
|
typedef struct {
|
|
int row;
|
|
int col;
|
|
} Position;
|
|
|
|
#define EMPTY_CELL 0
|
|
#define BOMB_CELL -1
|
|
#define HIDDEN_CELL -2
|
|
#define NUMBER_CELL -3
|
|
#define FLAG_CELL -4
|
|
|
|
int** generateGameBoard(int size);
|
|
void placeBombs(int** gameBoard, int size, int numBombs);
|
|
void displayGameBoardUART(int** gameBoard, int size, int numBombs, int numFlags);
|
|
void freeGameBoard(int** gameBoard, int size);
|
|
int** createHiddenGameBoard(int** gameBoard, int size);
|
|
int** revealCell(int** gameBoard, int** hiddenGameBoard, int size, int row, int col);
|
|
void getPositionIndices(int row, int col, Position* pos);
|
|
void getNewPosition(Position* pos, int dx, int dy, Position* newPos);
|
|
|
|
#endif /* INC_SPIELFELD_H_ */
|