aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-10 22:47:40 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-10 22:47:40 +0300
commitca745926cf181e1aee026c48335543610f60770e (patch)
treecb577ec6caafa25dfed03c71288fe15e2715b78d
parentcecf821c9526ba2e93288f4f0ff354b2cb98c452 (diff)
downloadcarcassonne-engine-c-ca745926cf181e1aee026c48335543610f60770e.tar.gz
feat: add more tiles
-rw-r--r--src/main.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 595d97a..888763d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
+#include <time.h>
#include "board.h"
int get_player_color(int player) {
@@ -28,6 +29,7 @@ int main() {
initscr();
cbreak();
use_default_colors();
+ srand(time(NULL));
/* colors */
start_color();
@@ -55,12 +57,31 @@ int main() {
Tile tile = { "FRCR", 'R', 0 };
place_tile(tile, translate_coordinate(BOARD_WIDTH * BOARD_WIDTH / 2), board, 1);
- Tile tileset[5] = {
+ Tile tileset[19] = {
+ /* cities */
+ { "FFFF", 'F', 0 },
+ { "CFFF", 'F', 0 },
+ { "FCFC", 'C', 0 },
+ { "FCFC", 'F', 0 },
+ { "CCFF", 'C', 0 },
+ { "CCFF", 'F', 0 },
+ { "CCCF", 'C', 0 },
+ { "CCCC", 'C', 0 },
+
+ /* roads */
+ { "FFFR", 'R', 0 },
+ { "FRFR", 'R', 0 },
+ { "FFRR", 'R', 0 },
+ { "FRRR", '+', 0 },
{ "RRRR", '+', 0 },
- { "FCCC", 'C', 0 },
- { "FFFC", 'C', 0 },
+
+ /* mix */
+ { "CRFR", 'R', 0 },
+ { "CFRR", 'R', 0 },
+ { "CRRF", 'R', 0 },
+ { "CRRR", '+', 0 },
{ "CCRR", '*', 0 },
- { "RFRF", 'R', 0 }
+ { "CCCR", 'C', 0 },
};
/* main loop */
@@ -72,7 +93,7 @@ int main() {
draw_board(board, meeple_map, board_win);
/* tile placement */
- tile = tileset[rand() % 5];
+ tile = tileset[rand() % 19];
int position = 0;
BoardUnit board_preview[BOARD_UNITS];