-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.c
More file actions
76 lines (68 loc) · 1.35 KB
/
print.c
File metadata and controls
76 lines (68 loc) · 1.35 KB
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
/*
** print.c for print.c in /home/pras_m/rendu/cursus_dedie/Cartographer
**
** Made by PRAS Martin
** Login <pras_m@epitech.net>
**
** Started on Mon Nov 2 20:18:26 2015 PRAS Martin
** Last update Mon Nov 2 20:18:28 2015 PRAS Martin
*/
#include <unistd.h>
#include <stdlib.h>
#include "include/cartographer.h"
void print_north(int size, int exit_orientation, int exit_position)
{
int i;
int x;
i = 0;
x = 0;
my_putchar('X');
while (i < size)
{
if ((exit_orientation == 0) && (exit_position == i))
my_putchar(32);
else
my_putchar('X');
i++;
}
my_putstr("X\n");
}
void print_south(int size, int exit_orientation, int exit_position)
{
int i;
int x;
i = 0;
x = 0;
my_putchar('X');
while (i < size)
{
if ((exit_orientation == 2) && (exit_position == i))
my_putchar(32);
else
my_putchar('X');
i++;
}
my_putstr("X\n");
}
void print_tab(char ** tab, int size, int exit_orientation, int exit_position)
{
int i;
i = 0;
print_north(size, exit_orientation, exit_position);
while (i < size)
{
if ((exit_orientation == 3) && (exit_position == i))
my_putchar(32);
else
my_putchar('X');
my_putstr(tab[i]);
if ((exit_orientation == 1) && (exit_position == i))
my_putchar(32);
else
my_putchar('X');
my_putchar('\n');
i++;
}
print_south(size, exit_orientation, exit_position);
my_putchar('\n');
}