public Sample GetSample(ValueMap letters, int pos_x) { Sample key = new Sample(SAMPLE_X); int x = pos_x - SAMPLE_X + 1; for (int i = 0; i < SAMPLE_X; i++) { if ((x + i) < 0) key.Set(0, i); else if ((x + i) >= letters.GetSizeX()) key.Set(GRID_SIZE - 1, i); else key.Set(letters.GetValue(x + i, 0), i); } return key; }
void LearnWord(ValueMap word) { int size_x, pos_x; size_x = word.GetSizeX(); // Add the letters to the table for (pos_x = 1 - SAMPLE_X; pos_x < size_x; pos_x++) { int x = pos_x + SAMPLE_X - 1; Sample patch = GetSample(word, x); AddUsage(patch); } }