-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
57 lines (38 loc) · 1.01 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require_once __DIR__.'/vendor/autoload.php';
//$parser = new \App\Parser\OspsParser();
/*$matrix = new \App\SuccessorMatrix\SuccessorMatrix([
'json' => 'data/json/succesor_matrix.json',
'parser' => $parser
]);
$matrix->showLeaders();*/
$parser = new \App\Parser\OspsParser();
$words = $parser->getWordsOfLength(3);
//chcę tylko wyrazy bez spacji, zawierające scrabblowe znaki
//$regex = '/[A-Za-zżźćńółęąśŻŹĆĄŚĘŁÓŃ]+/';
//foreach ($words as $word) {
// echo $word . PHP_EOL;
//}
const WORD_SIZE = 3;
function find($words, $position = 1)
{
$possible = findForPosition($words, $position);
if ($position === WORD_SIZE && $possible) {
return array_merge($words, $possible);
} else {
foreach ($possible as $pWord) {
}
}
}
function findForPosition($words, $position)
{
}
$trie = new \Tries\Trie();
$squares = [];
foreach ($words as $word) {
$trie->add($word);
}
reset($words);
foreach ($words as $word) {
$square = find([$word]);
}