-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst-temp.c
86 lines (67 loc) · 1.48 KB
/
first-temp.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
int w,l,ps,pm;
int matrix[77][50];
int rnd(bool);
int direction_maker(int [77][50]);
bool direction_check(int[77][50],int,int);
int main () {
printf("<<<<Welcome to the Scotland Yard>>>>\n\n");
printf("Please enter the lenght of your game board:\n");
scanf("%d",&l);
printf("Please enter the width of your game board:\n");
scanf("%d",&w);
printf("Please enter the number of your Police Stations:\n");
scanf("%d",&ps);
srand(time(NULL));
int matrix[l][w]; //hole gameboard;
for (int i = 0; i < w; i++) // filling everywhere with 0;
{
for (int j = 0; j < l; j++)
{
matrix[i][j]=0;
// printf("0");
}
// printf("\n");
}
for (int psi = 1; psi <= ps; psi++)
{
int pmi=0;
printf("Please enter police number of the starion number : %d",psi);
scanf("%d",&pmi);
for (; pmi >=0; pmi--)
{
}
}
}
int rnd (bool hrz) {
if (hrz) {
return rand()%w;
}
else {
return rand()%l;
}
}
bool direction_check(int matrix[l][w],int x,int y)
{
if(matrix[x][y]==0)
{
return true;
}
else
{
return false;
}
}
int direction_maker(int matrix[l][w])
{
int tempx=0;
int tempy=0;
do
{
tempy = rnd(true);
tempx = rnd(false);
}while(!direction_check(matrix[l][w],tempx,tempy));
}