-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_print.c
143 lines (132 loc) · 2.66 KB
/
ft_print.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_print.c :+: :+: */
/* +:+ */
/* By: dsaripap <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/06/09 12:46:58 by dsaripap #+# #+# */
/* Updated: 2019/06/11 18:02:01 by ravan-de ######## odam.nl */
/* */
/* ************************************************************************** */
#include "fillit.h"
#include <stdio.h>
void print_board(uint16_t *board)
{
int bit;
int row;
uint16_t mask;
bit = 0;
row = 0;
while (row < 16)
{
bit = 0;
while (bit < 16)
{
mask = board[row] >> bit;
//printf("bit = %d , mask = %d , -- %d \n", bit, mask, mask & 1);
if (mask & 1)
printf("1 ");
else
printf("0 ");
bit++;
}
row++;
printf("\n");
if (row % 4 == 0)
{
printf("\n");
//printf("row = %d \n", row );
}
}
}
void print_binary(uint64_t num, int size)
{
int bit;
int row;
int col;
uint64_t mask;
bit = 0;
row = 0;
while (row < size)
{
col = 0;
while (col < (size * size))
{
mask = num >> bit;
//printf("\n mask = %llu \n", mask);
if (mask & 1)
printf("1 ");
else
printf("0 ");
bit++;
col++;
}
row++;
printf("\n");
}
}
void print_binary_orig(unsigned short num, int size)
{
int bit;
int row;
int col;
unsigned short mask;
bit = 0;
row = 0;
while (row < size)
{
col = 0;
while (col < size)
{
mask = num >> bit;
if (mask & 1)
printf("1 ");
else
printf("0 ");
bit++;
col++;
}
row++;
printf("\n");
}
}
void print_binary_d(uint64_t num, int size)
{
int bit;
int row;
int col;
unsigned short mask;
bit = 0;
row = 0;
while (row < size)
{
col = 0;
while (col < size)
{
mask = num >> bit;
if (mask & 1)
printf("1 ");
else
printf("0 ");
bit++;
col++;
}
row++;
printf("\n");
}
}
void print_list(t_list **tetr_lst)
{
t_list *temp;
size_t i;
i = 1;
printf(ANSI_COLOR_CYAN "\n=== Printing Linked List of Tetriminos ===\n" ANSI_COLOR_RESET);
temp = *tetr_lst;
while (temp != NULL)
{
printf(" tetr/node %lu -> %llu \n", i, *(uint64_t *)(temp->content));
temp = temp->next;
i++;
}
}