commit 8a15841736af503f565916883f2dd7c309225b3a
parent c9843e6b904d0b3122682e2f8d9e72f786139033
Author: Christos Margiolis <christos@margiolis.net>
Date: Wed, 22 Jan 2020 21:53:40 +0200
edited README and minesweeper Makefile to support Windows
Diffstat:
7 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/assignment-1.5-arrays-pointers-files/README.md b/assignment-1.5-arrays-pointers-files/README.md
@@ -1,7 +1,5 @@
# Assignment 1.5: Arrays - Pointers - Files
-**UNDER CONSTRUCTION, THE PROGRAMS DON'T WORK WELL YET**
-
## Programs
* combinations
@@ -21,16 +19,30 @@
* Move with `w`/`s`/`a`/`d` or Vim keys (`k`/`j`/`h`/`l`)
* Open cell with `[ENTER]` or `o`
* Flag cell with `f`
-* Defuse mine (if flagged) with `g`
+* Defuse mine (only if flagged) with `g`
+* You win if you defuse all the mines
+* You lose in case you open a mine or you try to defuse a flagged cell not containing a mine
* Quit with `q`
+### To Do
+
+* Fix screen bug with big dimensions
+* Add colors
+
+## Combinations / KCombinations / FCombinations
+
+Combination printing programs
+
## Execution
-* ```program_name``` = program's name
-* ```full_path/``` = full path
+* `program_name` = program's name
+* `full_path/` = full path
### Linux
+**Dependencies**
+* `ncurses`
+
```shell
$ cd full_path/assignment-1.5-arrays-pointers-files/program_name
$ make
@@ -42,7 +54,8 @@ $ make clean # optional
**Dependencies:**
* MinGW gcc compiler
-* ```make```
+* `make`
+* `PDCurses` library (for minesweeper)
In CMD, do the following:
diff --git a/assignment-1.5-arrays-pointers-files/minesweeper/Makefile b/assignment-1.5-arrays-pointers-files/minesweeper/Makefile
@@ -7,14 +7,32 @@ BIN_DIR = bin
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
-MOVE = mv
-MKDIR_P = mkdir -p
-
CC = gcc
CPPFLAGS += -Iinclude
-CFLAGS += -Wall
+CFLAGS += -Wall
LDFLAGS += -Llib
-LDLIBS += -lm -lncurses
+
+ifeq ($(OS),Windows_NT)
+ detected_OS := Windows
+else
+ detected_OS := $(shell uname)
+endif
+ifeq ($(OS),Linux)
+ detected_OS := Linux
+else
+ detected_OS := $(shell uname)
+endif
+
+ifeq ($(detected_OS),Linux)
+ LDLIBS += -lm -lncurses
+ MOVE = mv
+ MKDIR_P = mkdir -p
+endif
+ifeq ($(detected_OS),Windows)
+ LDLIBS += -lm -LC:\PDCurses\wincon -lpdcurses
+ MOVE = move
+ MKDIR_P = md
+endif
.PHONY: all clean
diff --git a/assignment-1.5-arrays-pointers-files/minesweeper/bin/minesweeper b/assignment-1.5-arrays-pointers-files/minesweeper/bin/minesweeper
Binary files differ.
diff --git a/assignment-1.5-arrays-pointers-files/minesweeper/mnsout.txt b/assignment-1.5-arrays-pointers-files/minesweeper/mnsout.txt
@@ -1,42 +1,14 @@
-Mine hit at position (4, 7)
+Mine hit at position (2, 6)
Board overview
-1 * 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-1 1 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- 1 1 1 - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 - - - - - - - -
-- 1 * 1 - 1 1 1 - - - - - - - - - - 1 2 2 1 - - - - - 1 * 1 - - - - - - - -
-- 1 1 1 - 1 D 1 1 1 1 - - - - - - - 1 * * 1 - - - - - 1 1 1 - - - - 1 1 1 -
-- - - - - 1 1 1 1 * 1 - - - - - - - 1 2 2 1 - - - - - - - - - - - - 1 * 1 -
-- 1 1 1 - - - - 1 1 1 - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 -
-- 1 * 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- 1 1 1 - - - - - - - - - - - - - - - - - 1 1 1 - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - 1 * 1 - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - 1 1 1 - - - - - - - - 1 1 1 - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 * 1 - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 1
-- - - - - - - - - - - - - - - - 1 1 1 - - - - - - - - - - - - - - - - - 1 *
-- - - - - - - - - - - - - - - - 1 * 1 - - - - - - - - - - - - - - - - - 1 1
-- - - - - - - - - - - - - - - - 1 1 1 - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - 1 1 1 - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - 1 * 1 - - - - - - - - - - 1 1 1 - - - - - - - -
-1 1 1 - - - - - - - - - - - 1 1 1 - - - - - - - - - - 1 * 1 - - - - - - - -
-1 * 1 - - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 - - - - - - - -
-1 1 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 * 1 - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 1 1 - - - - -
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-1 1 1 - - - - - - - - - - - - 1 1 1 - - - - - - - - - - - - - - - - - - - -
-1 * 1 - - - - - - - - - - - - 1 * 1 - - - - - - - - - - - - - - - - - - - -
+- - - - 1 1 1 - - -
+- - - - 1 * 1 - - -
+1 1 - - 1 1 1 - - -
+* 1 1 1 1 - - - - -
+2 2 3 * 2 - 1 1 1 -
+1 * 3 * 2 - 1 * 1 -
+2 2 2 1 1 - 1 1 1 -
+* 1 - - 1 1 1 - - -
+2 2 1 1 2 * 1 - - -
+1 * 1 1 * 2 1 - - -
diff --git a/assignment-1.5-arrays-pointers-files/minesweeper/obj/outputs.o b/assignment-1.5-arrays-pointers-files/minesweeper/obj/outputs.o
Binary files differ.
diff --git a/assignment-1.5-arrays-pointers-files/minesweeper/src/outputs.c b/assignment-1.5-arrays-pointers-files/minesweeper/src/outputs.c
@@ -89,7 +89,7 @@ void game_over(WINDOW *gameWin, char **mineboard, int yMiddle, int xMiddle)
wclear(gameWin);
wrefresh(gameWin);
wattron(stdscr, A_BOLD);
- mvwprintw(stdscr, yMiddle-2, xMiddle-22, "You hit a mine! (or tried defused the wrong cell)");
+ mvwprintw(stdscr, yMiddle-2, xMiddle-24, "You hit a mine! (or tried to defuse the wrong cell)");
mvwprintw(stdscr, yMiddle-1, xMiddle-4, "Game over :(");
mvwprintw(stdscr, yMiddle, xMiddle-11, "Press any key to continue");
refresh();
diff --git a/assignment-1.5-arrays-pointers-files/notes.md b/assignment-1.5-arrays-pointers-files/notes.md
@@ -1,2 +0,0 @@
-* meter function
-* kcombinations-
\ No newline at end of file