bool GaddagFactory::pushWord(const UVString &word) { UVString leftover; Quackle::LetterString encodedWord = m_alphas->encode(word, &leftover); if (leftover.empty()) { pushWord(encodedWord); return true; } ++m_unencodableWords; return false; }
void BallSearch::pushWord(string word) { Word w; w.name = word; string::size_type pos; int x = 0; int y = 0; for (pos = 0; pos <= word.length(); ++pos) { int c = pos < word.length() ? word[pos] : -1; switch(c) { case 'm': --x; break; case 'M': ++x; break; case 'n': --y; break; case 'N': ++y; break; default: { if (x != 0 || y != 0) { w.matrix = w.matrix*constructT(params, x, y); x=y=0; } if (c == 'g') { w.matrix = w.matrix*g; } else if (c == 'G') { w.matrix = w.matrix*G; } } } } //printf("pushWord(%s): distance=%f\n", w.name.c_str(), 0.5 / norm(w.matrix.c)); pushWord(w); Word wInv = inverse(w); findNames(wInv); pushWord(wInv); //fprintf(stderr, "pushed words %s(%s) and %s(%s)\n", //w.name.c_str(), w.nameClass.c_str(), //wInv.name.c_str(), wInv.nameClass.c_str()); }
void interpretLoad(Instruction* ins) { switch(ins->argSize) { case 1: pushByte(readByte(popDword())); break; case 2: pushWord(readWord(popDword())); break; case 4: pushDword(readDword(popDword())); break; case 8: pushQword(readQword(popDword())); break; } }
void interpretConv(Instruction* ins) { switch(ins->opcode) { case CONVB_D: pushDword((uint32_t)popByte()); break; case CONVD_B: pushByte((uint8_t)popDword()); break; case CONVD_W: pushWord((uint16_t)popDword()); break; case CONVQ_D: pushQword((uint64_t)popDword()); break; case CONVD_Q: pushDword((uint32_t)popQword()); break; } }