-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecret.h
More file actions
54 lines (38 loc) · 1.04 KB
/
secret.h
File metadata and controls
54 lines (38 loc) · 1.04 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
/**
* \file secret.h
* The super mind master's secret.
*/
#ifndef __SECRET_H_
#define __SECRET_H_
/** Number of colors */
#define COLORS_NB 8
/** Number of keys in the code */
#define CODE_LENGHT 5
/** The possible color for each code's key */
typedef enum color_ {
UNDEFINED=-1, RED, GREEN, BLUE, WHITE, ORANGE, CYAN, YELLOW, PURPLE
} color_t;
/** A type to store the secret*/
typedef color_t code_t[CODE_LENGHT];
/**
* Compare a combinaison to the secret code will result in two int.
* The first for the number of good placements.
* The second for good colors at the bad place.
*/
typedef int test_t[2];
/**
* Put a new random code in a pointed location.
* \param code a pre-allocated code location
* \return 0 in case of success
*/
int change_code(code_t *code);
/**
* Verify that all the keys in a code are defined.
* \return 1 is there a no UNDEFINED value in code, 0 otherwise
*/
int is_completed(code_t *code);
/**
* Compare a combinaison to the secret code.
*/
int *test(code_t *combinaison, code_t *secret);
#endif