summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-12-08 19:51:43 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2022-12-08 19:51:43 -0500
commit1d1e94e1b44f3afdcb873bd520f5ef8bc2d395ec (patch)
tree80602d1e26c7ca6cc426a0a03e48c4791c52e856
parentaa234f0ac61e1b216402fb554de26dd16a413a6c (diff)
downloadlingo-1d1e94e1b44f3afdcb873bd520f5ef8bc2d395ec.tar.gz
lingo-1d1e94e1b44f3afdcb873bd520f5ef8bc2d395ec.tar.bz2
lingo-1d1e94e1b44f3afdcb873bd520f5ef8bc2d395ec.zip
Spaceless counts, admissable results are tuned more
-rw-r--r--lingo.cpp60
1 files changed, 34 insertions, 26 deletions
diff --git a/lingo.cpp b/lingo.cpp index e0d1bfc..2e1a6bd 100644 --- a/lingo.cpp +++ b/lingo.cpp
@@ -148,6 +148,8 @@ private:
148 } else { 148 } else {
149 std::cout << "▪️"; 149 std::cout << "▪️";
150 } 150 }
151 } else {
152 std::cout << "▪️";
151 } 153 }
152 } 154 }
153 std::cout << std::endl; 155 std::cout << std::endl;
@@ -179,7 +181,7 @@ private:
179 verbly::form::id))))); 181 verbly::form::id)))));
180 break; 182 break;
181 } 183 }
182 default: break; // Not supposed yet. 184 default: break; // Not supported yet.
183 } 185 }
184 break; 186 break;
185 } 187 }
@@ -189,7 +191,7 @@ private:
189 forwardFilter &= (verbly::word::antonyms %= wordFilter); 191 forwardFilter &= (verbly::word::antonyms %= wordFilter);
190 break; 192 break;
191 } 193 }
192 default: break; // Not supposed yet. 194 default: break; // Not supported yet.
193 } 195 }
194 break; 196 break;
195 } 197 }
@@ -199,7 +201,7 @@ private:
199 forwardFilter &= (verbly::notion::causes %= wordFilter); 201 forwardFilter &= (verbly::notion::causes %= wordFilter);
200 break; 202 break;
201 } 203 }
202 default: break; // Not supposed yet. 204 default: break; // Not supported yet.
203 } 205 }
204 break; 206 break;
205 } 207 }
@@ -217,7 +219,7 @@ private:
217 forwardFilter &= (verbly::notion::partMeronyms %= wordFilter); 219 forwardFilter &= (verbly::notion::partMeronyms %= wordFilter);
218 break; 220 break;
219 } 221 }
220 default: break; // Not supposed yet. 222 default: break; // Not supported yet.
221 } 223 }
222 break; 224 break;
223 } 225 }
@@ -235,7 +237,7 @@ private:
235 forwardFilter &= (verbly::notion::partHolonyms %= wordFilter); 237 forwardFilter &= (verbly::notion::partHolonyms %= wordFilter);
236 break; 238 break;
237 } 239 }
238 default: break; // Not supposed yet. 240 default: break; // Not supported yet.
239 } 241 }
240 break; 242 break;
241 } 243 }
@@ -249,7 +251,7 @@ private:
249 forwardFilter &= (verbly::pronunciation::rhymes %= wordFilter); 251 forwardFilter &= (verbly::pronunciation::rhymes %= wordFilter);
250 break; 252 break;
251 } 253 }
252 default: break; // Not supposed yet. 254 default: break; // Not supported yet.
253 } 255 }
254 break; 256 break;
255 } 257 }
@@ -269,11 +271,11 @@ private:
269 verbly::form::id))); 271 verbly::form::id)));
270 break; 272 break;
271 } 273 }
272 default: break; // Not supposed yet. 274 default: break; // Not supported yet.
273 } 275 }
274 break; 276 break;
275 } 277 }
276 default: break; // Not supposed yet. 278 default: break; // Not supported yet.
277 } 279 }
278 } 280 }
279 281
@@ -302,7 +304,7 @@ private:
302 verbly::form::id))))); 304 verbly::form::id)))));
303 break; 305 break;
304 } 306 }
305 default: break; // Not supposed yet. 307 default: break; // Not supported yet.
306 } 308 }
307 break; 309 break;
308 } 310 }
@@ -312,7 +314,7 @@ private:
312 questionFilter = (verbly::word::antonyms %= solution); 314 questionFilter = (verbly::word::antonyms %= solution);
313 break; 315 break;
314 } 316 }
315 default: break; // Not supposed yet. 317 default: break; // Not supported yet.
316 } 318 }
317 break; 319 break;
318 } 320 }
@@ -322,7 +324,7 @@ private:
322 questionFilter = (verbly::notion::effects %= solution); 324 questionFilter = (verbly::notion::effects %= solution);
323 break; 325 break;
324 } 326 }
325 default: break; // Not supposed yet. 327 default: break; // Not supported yet.
326 } 328 }
327 break; 329 break;
328 } 330 }
@@ -344,7 +346,7 @@ private:
344 questionFilter = (verbly::notion::partMeronyms %= solution); 346 questionFilter = (verbly::notion::partMeronyms %= solution);
345 break; 347 break;
346 } 348 }
347 default: break; // Not supposed yet. 349 default: break; // Not supported yet.
348 } 350 }
349 break; 351 break;
350 } 352 }
@@ -366,7 +368,7 @@ private:
366 //questionFilter &= !(verbly::notion::words %= solution); 368 //questionFilter &= !(verbly::notion::words %= solution);
367 break; 369 break;
368 } 370 }
369 default: break; // Not supposed yet. 371 default: break; // Not supported yet.
370 } 372 }
371 break; 373 break;
372 } 374 }
@@ -380,7 +382,7 @@ private:
380 questionFilter = (verbly::form::merographs %= (verbly::form::length >= 4 && (verbly::form::holographs %= solution))); 382 questionFilter = (verbly::form::merographs %= (verbly::form::length >= 4 && (verbly::form::holographs %= solution)));
381 break; 383 break;
382 } 384 }
383 default: break; // Not supposed yet. 385 default: break; // Not supported yet.
384 } 386 }
385 break; 387 break;
386 } 388 }
@@ -400,11 +402,11 @@ private:
400 verbly::form::id))); 402 verbly::form::id)));
401 break; 403 break;
402 } 404 }
403 default: break; // Not supposed yet. 405 default: break; // Not supported yet.
404 } 406 }
405 break; 407 break;
406 } 408 }
407 default: break; // Not supposed yet. 409 default: break; // Not supported yet.
408 } 410 }
409 verbly::form questionPart = database_->forms(questionFilter && cleanFilter).first(); 411 verbly::form questionPart = database_->forms(questionFilter && cleanFilter).first();
410 msg_stream << COLOUR_EMOJIS[*colour] << " " << questionPart.getText() << std::endl; 412 msg_stream << COLOUR_EMOJIS[*colour] << " " << questionPart.getText() << std::endl;
@@ -427,7 +429,7 @@ private:
427 verbly::form::id))))); 429 verbly::form::id)))));
428 break; 430 break;
429 } 431 }
430 default: break; // Not supposed yet. 432 default: break; // Not supported yet.
431 } 433 }
432 break; 434 break;
433 } 435 }
@@ -437,7 +439,7 @@ private:
437 admissable &= (verbly::word::antonyms %= addedClause); 439 admissable &= (verbly::word::antonyms %= addedClause);
438 break; 440 break;
439 } 441 }
440 default: break; // Not supposed yet. 442 default: break; // Not supported yet.
441 } 443 }
442 break; 444 break;
443 } 445 }
@@ -447,7 +449,7 @@ private:
447 admissable &= (verbly::notion::causes %= addedClause); 449 admissable &= (verbly::notion::causes %= addedClause);
448 break; 450 break;
449 } 451 }
450 default: break; // Not supposed yet. 452 default: break; // Not supported yet.
451 } 453 }
452 break; 454 break;
453 } 455 }
@@ -465,7 +467,7 @@ private:
465 admissable &= (verbly::notion::partMeronyms %= addedClause); 467 admissable &= (verbly::notion::partMeronyms %= addedClause);
466 break; 468 break;
467 } 469 }
468 default: break; // Not supposed yet. 470 default: break; // Not supported yet.
469 } 471 }
470 break; 472 break;
471 } 473 }
@@ -483,7 +485,7 @@ private:
483 admissable &= (verbly::notion::partHolonyms %= addedClause); 485 admissable &= (verbly::notion::partHolonyms %= addedClause);
484 break; 486 break;
485 } 487 }
486 default: break; // Not supposed yet. 488 default: break; // Not supported yet.
487 } 489 }
488 break; 490 break;
489 } 491 }
@@ -497,7 +499,7 @@ private:
497 admissable &= (verbly::pronunciation::rhymes %= addedClause); 499 admissable &= (verbly::pronunciation::rhymes %= addedClause);
498 break; 500 break;
499 } 501 }
500 default: break; // Not supposed yet. 502 default: break; // Not supported yet.
501 } 503 }
502 break; 504 break;
503 } 505 }
@@ -517,23 +519,29 @@ private:
517 verbly::form::id))); 519 verbly::form::id)));
518 break; 520 break;
519 } 521 }
520 default: break; // Not supposed yet. 522 default: break; // Not supported yet.
521 } 523 }
522 break; 524 break;
523 } 525 }
524 default: break; // Not supposed yet. 526 default: break; // Not supported yet.
525 } 527 }
526 } else { 528 } else {
527 msg_stream << "▪️" << std::endl; 529 msg_stream << "▪️" << std::endl;
528 } 530 }
529 } 531 }
530 msg_stream << "(" << solution.getText().size() << ")"; 532 std::string spaceless = solution.getText();
533 while (spaceless.find(" ") != std::string::npos)
534 {
535 spaceless.erase(spaceless.find(" "), 1);
536 }
537
538 msg_stream << "(" << spaceless.size() << ")";
531 539
532 std::string message_text = msg_stream.str(); 540 std::string message_text = msg_stream.str();
533 std::cout << message_text << std::endl << std::endl << solution.getText() << std::endl; 541 std::cout << message_text << std::endl << std::endl << solution.getText() << std::endl;
534 542
535 std::vector<verbly::form> admissableResults = database_->forms(admissable).all(); 543 std::vector<verbly::form> admissableResults = database_->forms(admissable).all();
536 if (admissableResults.size() <= 5) 544 if (admissableResults.size() <= (hints == 1 ? 2 : 5))
537 { 545 {
538 dpp::message message(channel, message_text); 546 dpp::message message(channel, message_text);
539 bot_->message_create(message, [this, &solution](const dpp::confirmation_callback_t& userdata) { 547 bot_->message_create(message, [this, &solution](const dpp::confirmation_callback_t& userdata) {