-
Notifications
You must be signed in to change notification settings - Fork 0
/
grid.c
51 lines (46 loc) · 1.42 KB
/
grid.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* grid.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ptao <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/30 12:44:59 by ptao #+# #+# */
/* Updated: 2016/01/31 18:23:19 by ptao ### ########.fr */
/* */
/* ************************************************************************** */
#include "game.h"
int define_lenside(void)
{
int entry;
int lenside;
printw("Enter the width of your grid (between 4 and 9) :\n");
entry = getch();
while (entry < 52 || entry > 57)
{
printw("\nIncorrect width, please re-enter the width :\n");
entry = getch();
}
lenside = entry - 48;
return (lenside);
}
int max_score(int lenside, int tab[lenside][lenside])
{
int i;
int j;
int max;
i = 0;
max = 0;
while (i < lenside)
{
j = 0;
while (j < lenside)
{
if (tab[i][j] > max)
max = tab[i][j];
j++;
}
i++;
}
return (max);
}