Controller::Controller(): n("~"), new_task(false), ac_speak("/speak", true), ac_gaze("/gaze_at_pose", true), memory_ppl(), name_dict(), person_id(-1), client_facts(n.serviceClient<facts::TellFacts>("/tell_facts")), initialized(false), client_weather(n.serviceClient<weather::TellWeather>("/tell_weather")), person_counter(0), person_last_id(-1), sleepStarted(ros::Time::now() - ros::Duration(30)), speek_rate_(1./10.) { name_tag_sub = n.subscribe<circle_detection::detection_results_array>("/circle_detection/results_array", 1000, &Controller::tagSubscriber, this); rnd_walk_start = n.serviceClient<std_srvs::Empty>("/start_random_walk"); rnd_walk_stop = n.serviceClient<std_srvs::Empty>("/stop_random_walk"); fillDictionary(); ros::spinOnce(); }
int main(){ int games, i,j,k; scanf("%d", &games); trie * dictionary = malloc(sizeof(trie)); for (j = 0; j < 26; ++j) { dictionary->nextLetter[j] = NULL; } dictionary = fillDictionary(dictionary); for (i = 0; i < games; ++i) { char** board = getInput(); int ** visited = malloc(sizeof(int **)); for (j = 0; j < 4; ++j) { visited[j] = calloc(4, sizeof(int *)); } printf("Words for game #%d:\n", i + 1); //Uses all 16 spots as a starting point. malloc is * 16 because the max word size is 16. char* tempWord = malloc(sizeof(char) * 16); for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { visited[j][k] = 1; checkSpot(j,k,visited,board,tempWord,dictionary,1); visited[j][k] = 0; } } free(tempWord); free(visited); free(board); printf("\n\n"); } freeDictionary(dictionary); return 0; }