-
Notifications
You must be signed in to change notification settings - Fork 0
BOGGLE
zaeval edited this page Nov 30, 2019
·
3 revisions
기제조건을 앞쪽에 적지않아 runtime error를 경험 예)
bool hasWord(int x, int y,int level,string &word,vector<string> &map){
if(map[y][x] != word[level]){ // 이부분에서 런타임에러가 남
return false;
}
if(x >= MAX_SIZE || y >= MAX_SIZE || x < 0 || y < 0){
return false;
}
if(level >= word.length()){
return true;
}
for(int direct = 0; direct < DIRECT_MAX; ++direct){
if(hasWord(x+DELTA_X[direct],y+DELTA_Y[direct],level+1,word,map))
return true;
}
return false;
}