-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplansza.c
More file actions
44 lines (41 loc) · 823 Bytes
/
plansza.c
File metadata and controls
44 lines (41 loc) · 823 Bytes
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
#include "init.h"
#include "plansza.h"
#include "snake.h"
void initplansza(int tab[][200], int width, int height)
{
int nwidth = width / SKOK, nheight = height / SKOK;
for (int i = 1; i < nheight; i++)
{
for (int j = 0; j < nwidth; j++)
{
if (i == 1 || i + 1 == nheight || j == 0 || j + 1 == nwidth)
tab[j][i] = SCIANA;
}
}
if (width == 640)
{
for (int i = 5; i < 8; i++)
{
tab[0][i] = PUSTEPOLE;
tab[nwidth - 1][i] = PUSTEPOLE;
}
}
else if (width == 840)
{
for (int i = 7; i <= 10; i++)
{
tab[0][i] = PUSTEPOLE;
tab[nwidth - 1][i] = PUSTEPOLE;
}
}
else
{
for (int i = 5; i <= 7; i++)
{
tab[0][i] = PUSTEPOLE;
tab[0][i+10] = PUSTEPOLE;
tab[nwidth - 1][i] = PUSTEPOLE;
tab[nwidth - 1][i+10] = PUSTEPOLE;
}
}
}