random

:-)
git clone read: git://git.margiolis.net/random.git
Log | Files | Refs | LICENSE

defs.h (2004B)


      1 #ifndef DEFS_H
      2 #define DEFS_H
      3 
      4 #define MOVE_UP			'w'
      5 #define MOVE_DOWN		's'
      6 #define MOVE_LEFT		'a'
      7 #define MOVE_RIGHT		'd'
      8 #define MOVE_ENTER		'\n'
      9 #define MOVE_OPEN_CELL		'o'
     10 #define MOVE_FLAG_CELL		'f'
     11 #define MOVE_DEFUSE_CELL	'g'
     12 #define MOVE_OPEN_MENU		'c'
     13 #define MOVE_QUIT		'q'
     14 
     15 #define MINE_DEFUSED		'D'
     16 #define CELL_FLAGGED		'F'
     17 #define CELL_BLANK		' '
     18 #define CELL_MINE		'*'
     19 #define GRID_BOX		"[ ]"
     20 
     21 #define OPT_CTRLS		"c Controls"
     22 #define OPT_QUIT		"q	   Quit"
     23 #define OPT_MOVE_UP		"w/k	   Move up"
     24 #define OPT_MOVE_DOWN		"s/j	   Move down"
     25 #define OPT_MOVE_LEFT		"a/h	   Move left"
     26 #define OPT_MOVE_RIGHT		"d/l	   Move right"
     27 #define OPT_FLAG_CELL		"f	   Flag cell"
     28 #define OPT_DEFUSE		"g	   Defuse (if flagged only)"
     29 #define OPT_OPEN_CELL		"[ENTER]/o Open cell"
     30 
     31 #define MSG_COLS		"Columns (Min = %d, Max = %d): "
     32 #define MSG_ROWS		"Rows (Min = %d, Max = %d): "
     33 #define MSG_MINES		"Mines (Min = %d, Max = %d): "
     34 #define MSG_QUIT_MENU		"Press any key to quit the menu"
     35 #define MSG_CONT		"Press any key to continue"
     36 #define MSG_CURPOS		"Current position: (%d, %d) "
     37 #define MSG_NDEFUSED		"Defused mines: %d/%d"
     38 #define MSG_WIN_1		"You defused all the mines!"
     39 #define MSG_WIN_2		"You won :)"
     40 #define MSG_LOSE_1		"You hit a mine! (or tried to defuse the wrong cell)"
     41 #define MSG_LOSE_2		"Game over :("
     42 
     43 #define GAME_LOST		0
     44 #define GAME_WON		1
     45 
     46 #define YMID(x)			(getmaxy((x)) >> 1)
     47 #define XMID(x)			(getmaxx((x)) >> 1)
     48 #define SCRSPACE_X(x)		((x) * 3 + 2)
     49 #define SCRSPACE_Y(y)		((y) + 2)
     50 #define ARRSPACE_X(x)		(((x) - 2) / 3)
     51 #define ARRSPACE_Y(y)		((y) - 1)
     52 #define CENTER(x, y)		(((x) >> 1) - ((y) >> 1))
     53 #define CURS_UPDATE(m, y, x)	(wmove((m)->gw, (y), (x)))
     54 #define IS_MINE(m, r, c)	((m)->mineboard[(r)][(c)] == CELL_MINE)
     55 #define IS_FLAGGED(m, r, c)	((m)->dispboard[(r)][(c)] == CELL_FLAGGED)
     56 #define IS_BLANK(m, r, c)	((m)->dispboard[(r)][(c)] == CELL_BLANK)
     57 #define OUT_OF_BOUNDS(m, r, c)	\
     58 	((r) < 0 || (r) > ((m)->rows - 1) || (c) < 0 || (c) > ((m)->cols - 1))
     59 
     60 #endif /* DEFS_H */