public function Scan($letters)
 {
     $set = Dictionary::GetSet($letters);
     $size = strlen($letters);
     $words_play = array();
     for ($direction = 0; $direction <= 1; $direction++) {
         for ($index = 0; $index <= 14; $index++) {
             switch ($direction) {
                 case 0:
                     $slice = $this->GetSlice(0, $index, 15, 0);
                     break;
                 case 1:
                     $slice = $this->GetSlice($index, 0, 15, 1);
                     break;
             }
             for ($this_size = $size; $this_size > 0; $this_size--) {
                 $position = 0;
                 do {
                     $pattern_info = $this->GetPattern($slice, $this_size, $position);
                     $start_position = $pattern_info['start_position'];
                     switch ($direction) {
                         case 0:
                             $x = $start_position;
                             $y = $index;
                             break;
                         case 1:
                             $x = $index;
                             $y = $start_position;
                             break;
                     }
                     if ($pattern_info['hit_tile'] || $this->HasAdjoining($x, $y, $direction, $this_size)) {
                         $words_found = $this->dictionary->FindWords($pattern_info['pattern'], $set);
                         $hit_tile = $pattern_info['hit_tile'];
                         foreach ($words_found as $word_found_info) {
                             $word_found = $word_found_info[0];
                             $blank_positions = $word_found_info[1];
                             $word_found_ok = true;
                             $score = 0;
                             $word_length = strlen($word_found);
                             for ($letter_index = 0; $letter_index < $word_length; $letter_index++) {
                                 $letter = $word_found[$letter_index];
                                 $is_blank = in_array($letter_index, $blank_positions);
                                 $valid_word = array(true, 0);
                                 switch ($direction) {
                                     case 0:
                                         if (!is_object($this->board[$pattern_info['start_position'] + $letter_index + $index * 15])) {
                                             $valid_word = $this->ValidWord($letter, $is_blank, $pattern_info['start_position'] + $letter_index, $index, 1 - $direction);
                                         }
                                         break;
                                     case 1:
                                         if (!is_object($this->board[$index + ($pattern_info['start_position'] + $letter_index) * 15])) {
                                             $valid_word = $this->ValidWord($letter, $is_blank, $index, $pattern_info['start_position'] + $letter_index, 1 - $direction);
                                         }
                                         break;
                                 }
                                 if (!$valid_word[0]) {
                                     $word_found_ok = false;
                                     break;
                                 } else {
                                     $score += $valid_word[1];
                                 }
                             }
                             if ($word_found_ok) {
                                 switch ($direction) {
                                     case 0:
                                         $score += $this->Score($word_found, $blank_positions, $start_position, $index, 0);
                                         $words_play["{$word_found}|{$start_position}|{$index}|0"] = $score;
                                         break;
                                     case 1:
                                         $score += $this->Score($word_found, $blank_positions, $index, $start_position, 1);
                                         $words_play["{$word_found}|{$index}|{$start_position}|1"] = $score;
                                         break;
                                 }
                             }
                         }
                     }
                     $position++;
                 } while ($pattern_info['end_reached'] !== true);
             }
         }
     }
     return $words_play;
 }