Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
MagicWord
Commits
c0dded2c
Commit
c0dded2c
authored
May 09, 2019
by
Arnaud Bey
Browse files
add debug option to grid generation
parent
5971009c
Changes
5
Show whitespace changes
Inline
Side-by-side
application/src/LexiconBundle/Command/DeleteLexiconCommand.php
View file @
c0dded2c
...
...
@@ -50,13 +50,12 @@ class DeleteLexiconCommand extends ContainerAwareCommand
foreach
(
$score
->
getActivities
()
as
$activity
)
{
$em
->
remove
(
$activity
);
}
$output
->
writeln
(
'<comment>Suppression activity ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression score ok</comment>'
);
}
}
$em
->
flush
();
$output
->
writeln
(
'<comment>flush ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression activity ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression score ok</comment>'
);
// delete games
$em
->
getRepository
(
Game
::
class
)
->
deleteByLanguage
(
$language
);
$output
->
writeln
(
'<comment>Suppression game ok</comment>'
);
...
...
application/src/MagicWordBundle/Command/DeleteGridCommand.php
View file @
c0dded2c
...
...
@@ -50,13 +50,12 @@ class DeleteGridCommand extends ContainerAwareCommand
foreach
(
$score
->
getActivities
()
as
$activity
)
{
$em
->
remove
(
$activity
);
}
$output
->
writeln
(
'<comment>Suppression activity ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression score ok</comment>'
);
}
}
$em
->
flush
();
$output
->
writeln
(
'<comment>flush ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression activity ok</comment>'
);
$output
->
writeln
(
'<comment>Suppression score ok</comment>'
);
// delete games
$em
->
getRepository
(
Game
::
class
)
->
deleteByLanguage
(
$language
);
$output
->
writeln
(
'<comment>Suppression game ok</comment>'
);
...
...
@@ -67,7 +66,7 @@ class DeleteGridCommand extends ContainerAwareCommand
$em
->
remove
(
$grid
);
}
$em
->
flush
();
$output
->
writeln
(
'<
comment>Suppression grilles ok</comment
>'
);
$output
->
writeln
(
'<
info>############ SUPPRESSION GRIDS OK #############</info
>'
);
}
else
{
echo
'Argument missing'
;
}
...
...
application/src/MagicWordBundle/Command/GenerateGridCommand.php
View file @
c0dded2c
...
...
@@ -38,7 +38,7 @@ class GenerateGridCommand extends ContainerAwareCommand
while
(
$keptGrid
<
$number
)
{
$language
=
$em
->
getRepository
(
'LexiconBundle:Language'
)
->
findOneByValue
(
$languageName
);
$timeStart
=
microtime
(
true
);
$grid
=
$gridManager
->
generate
(
$language
);
$grid
=
$gridManager
->
generate
(
$language
,
true
);
$timeEnd
=
microtime
(
true
);
$executionTime
=
round
(
$timeEnd
-
$timeStart
,
2
);
$formCount
=
$grid
->
getFoundableForms
()
?
count
(
$grid
->
getFoundableForms
())
:
0
;
...
...
application/src/MagicWordBundle/Manager/GridManager.php
View file @
c0dded2c
...
...
@@ -48,11 +48,19 @@ class GridManager
}
public
function
generate
(
Language
$language
)
public
function
generate
(
Language
$language
,
$debug
=
false
)
{
$grid
=
$this
->
newGrid
(
$language
,
4
);
$letters
=
$this
->
letterLangManager
->
lottery
(
$language
,
4
);
$letters
=
$this
->
letterLangManager
->
lottery
(
$language
,
4
,
$debug
);
if
(
$debug
===
true
)
{
echo
"
\n
letters: "
;
foreach
(
$letters
as
$letter
)
{
echo
$letter
;
}
echo
"
\n
"
;
}
foreach
(
$letters
as
$letter
)
{
$square
=
$this
->
squareManager
->
create
(
$letter
,
$grid
);
...
...
application/src/MagicWordBundle/Manager/Letter/LetterLanguageManager.php
View file @
c0dded2c
...
...
@@ -22,7 +22,7 @@ class LetterLanguageManager
$this
->
em
=
$entityManager
;
}
public
function
lottery
(
Language
$language
,
$side
)
public
function
lottery
(
Language
$language
,
$side
,
$debug
=
false
)
{
$fileBigrams
=
$language
->
getDirectory
()
.
DIRECTORY_SEPARATOR
.
"bigrams.txt"
;
// On crée un tableau de bigrammes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment