void gameStudy::update() { //5초간 보여주고 다 다시 뒤집어주자 if (_TimeCount < 500) { _TimeCount++; if (_TimeCount == 500) { for (int i = 0; i < CardNum; i++) { inCardState[i].CardOpen = nonOpen; } } } if (KEYMANAGER->isOnceKeyDown(VK_LBUTTON) && _clickCount < 2) { for (int i = 0; i < CardNum; i++) { //첫클릭 오픈 & 인덱스 저장 if (PtInRect(&inCardState[i]._rc, _ptMouse) && _clickCount == 0) { inCardState[i].CardOpen = Open; first = i; _clickCount++; } //두번째 클릭 오픈 & 인덱스 저장 else if (PtInRect(&inCardState[i]._rc, _ptMouse) && _clickCount == 1) { inCardState[i].CardOpen = Open; second = i; _clickCount++; } } } //2번째 클릭이 되면 if (_clickCount == 2) { _TimeCount++; if (_TimeCount == 550) //0.5초 타이머 준후 { if (answerCheck(first, second)) //정답 2개 비교 맞으면 true값으로 { inCardState[first].answer = true; inCardState[second].answer = true; } for (int i = 0; i < CardNum; i++) //정답이 아닌 카드는 다시 뒤집기. 정답은 냅두기 { if (inCardState[i].answer) inCardState[i].CardOpen = Open; else if(!inCardState[i].answer) inCardState[i].CardOpen = nonOpen; } //카운트 0으로 초기화 _TimeCount = 500; _clickCount = 0; } } gameNode::update(); }
void possibleAns(char *string, int total, int pos, int countI, char* inA, char *inB){ int x; if (pos - countI <= countI){ if (countI == total/2){ memset((string + pos),'o', (total-pos)*sizeof(char)); *(string + total) = '\0'; //printf("%s\n" ,string); //if(strcmp(string,"iiioioiiiooiooiiiooioooo\0")==0) // printf("YES"); if (answerCheck(inA, inB, string)){ for (x=0; x < strlen(string)-1 ;x++) printf("%c ", string[x]); printf("%c\n", string[x]); } } else{ string[pos] = 'i'; possibleAns(string, total, pos+1, countI+1, inA, inB); string[pos] = 'o'; possibleAns(string, total, pos+1, countI, inA, inB); } } }