Good Day, I am working on a filler game where: two players gain points by placing on a board, one after the other, the game piece obtained by the game master (in the form of an executable Ruby program). The game ends when the game piece cannot be placed anymore.
Below is the code used to read my player number and starting piece:
***void init_player(t_player *player)***
{
char *line;
get_next_line(0, &line);
if ((!(ft_strncmp(line, "$$$ exec p", 10))))
{
if (line[10] == '1')
{
player->id = '1';
player->my_shape = 'O';
player->current_shape = 'o';
}
else
{
player->id = '2';
player->my_shape = 'X';
player->current_shape = 'x';
}
ft_strdel(&line);
return ;
}
return ;
}
int main(void)
{
t_player *me;
me = (t_player *)malloc(sizeof(*me));
init_player(me);
ft_putchar(me->my_shape);
ft_putchar('\n');
return (0);
}
Now I need help in reading the map size by creating a pointer to pointer of size n + 1 and n being 15 in this please see map below. Or I can try another approach you guys can advise. Thank you Check Map below
$$$ exec p1 : [players/abanlin.filler]
***Plateau 15 17:***
01234567890123456
000 .................
001 .................
002 .................
003 .................
004 .................
005 .................
006 .................
007 .................
008 ..O..............
009 .................
010 .................
011 .................
012 ..............X..
013 .................
014 .................
Piece 1 2:
**