-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.c
More file actions
34 lines (29 loc) · 651 Bytes
/
code.c
File metadata and controls
34 lines (29 loc) · 651 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
#include <stdio.h>
#include "code.h"
/* Musab Fiqi */
/*THE DEBUG MESSAGES FOR THESE FUNCTIONS ARE IN OUTPUT.C
*THIS IS BECAUSE THEY WOULD'VE RETURNED THE SAME VALUES EVERY TIME*/
/*return the color of the alien*/
int codeToColor (unsigned int code)
{
code = code << 25;
code = code >> 25;
code = code >> 4;
return (int) code;
}
/*returns the type of the alien*/
int codeToType (unsigned int code)
{
code = code << 17;
code = code >> 17;
code = code >> 12;
return (int) code;
}
/*return the point value of the alien*/
int codeToPoints (unsigned int code)
{
code = code << 3;
code = code >> 3;
code = code >> 20;
return (int) code;
}