-
Notifications
You must be signed in to change notification settings - Fork 0
/
fede.c
63 lines (58 loc) · 1.25 KB
/
fede.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
#include <stdio.h>
#include "mastermind.h"
void printSequence(char str[], int len){
int i;
for(i=0; i<len; i++){
if(str[i] == 'n'){
printf(BLKB);
}
if(str[i] == 'r'){
printf(REDB);
}
if(str[i] == 'g'){
printf(GRNB);
}
if(str[i] == 'y'){
printf(YELB);
}
if(str[i] == 'b'){
printf(BLUB);
}
if(str[i] == 'm'){
printf(MAGB);
}
if(str[i] == 'c'){
printf(CYNB);
}
if(str[i] == 'w'){
printf(WHTB);
}
printf(" ");
printf(reset);
}
}
void printWhiteBlack(int w, int b){
int i;
printf(WTILE);
for(i=0; i<w; i++){
printf("%d ", i+1);
}
printf(reset);
printf("\t");
printf(BTILE);
for(i=0; i<b; i++){
printf("%d ", i+1);
}
printf(reset);
}
int checkInput(char s[], int len){
int i, ris;
ris = 1;
for(i=0; i<s[i] && ris; i++){
ris = s[i]=='n' || s[i]=='r' || s[i]=='g' || s[i]=='y' || s[i]=='b' || s[i]=='m' || s[i]=='c' || s[i]=='w';
}
if(ris){
ris = i==len;
}
return ris;
}