Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
crossword
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Silas Dohm
crossword
Commits
8639d61c
Commit
8639d61c
authored
Oct 7, 2022
by
Silas Dohm
Browse files
Options
Downloads
Patches
Plain Diff
changed names
parent
2e5f3a92
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.js
+5
-5
5 additions, 5 deletions
main.js
with
5 additions
and
5 deletions
main.js
+
5
−
5
View file @
8639d61c
...
@@ -18,9 +18,7 @@ let columns, rows;
...
@@ -18,9 +18,7 @@ let columns, rows;
let
finished
=
false
;
let
finished
=
false
;
initPuzzle
();
initPuzzle
();
//todo : change active Word after action
function
kbEvent
(
e
)
{
document
.
addEventListener
(
'
keydown
'
,
logKey
);
function
logKey
(
e
)
{
lastCell
=
activeCell
;
lastCell
=
activeCell
;
switch
(
activeMode
)
{
switch
(
activeMode
)
{
case
mode
.
insert
:
case
mode
.
insert
:
...
@@ -131,6 +129,8 @@ function logKey(e) {
...
@@ -131,6 +129,8 @@ function logKey(e) {
}
}
endInput
();
endInput
();
}
}
document
.
addEventListener
(
'
keydown
'
,
kbEvent
);
canv
.
addEventListener
(
'
mousedown
'
,
function
(
e
)
{
//mouse navigation
canv
.
addEventListener
(
'
mousedown
'
,
function
(
e
)
{
//mouse navigation
let
x
=
Math
.
floor
(
e
.
offsetX
/
(
canv
.
clientWidth
/
columns
));
let
x
=
Math
.
floor
(
e
.
offsetX
/
(
canv
.
clientWidth
/
columns
));
let
y
=
Math
.
floor
(
e
.
offsetY
/
(
canv
.
clientHeight
/
rows
));
let
y
=
Math
.
floor
(
e
.
offsetY
/
(
canv
.
clientHeight
/
rows
));
...
@@ -173,7 +173,7 @@ function endInput() {
...
@@ -173,7 +173,7 @@ function endInput() {
if
(
activeCell
.
word
[
1
])
if
(
activeCell
.
word
[
1
])
activeCell
.
word
[
1
].
highlight
();
activeCell
.
word
[
1
].
highlight
();
}
}
checkWin
ner
();
check
4
Win
();
}
}
function
initNeighbours
()
{
function
initNeighbours
()
{
for
(
let
x
=
0
;
x
<
columns
;
x
++
)
{
//precompute neighbours
for
(
let
x
=
0
;
x
<
columns
;
x
++
)
{
//precompute neighbours
...
@@ -216,7 +216,7 @@ function initNeighbours() {
...
@@ -216,7 +216,7 @@ function initNeighbours() {
}
}
}
}
function
checkWin
ner
()
{
function
check
4
Win
()
{
for
(
i
=
0
;
i
<
columns
;
i
++
)
{
for
(
i
=
0
;
i
<
columns
;
i
++
)
{
for
(
j
=
0
;
j
<
rows
;
j
++
)
{
for
(
j
=
0
;
j
<
rows
;
j
++
)
{
if
(
cells
[
i
][
j
].
actualChar
.
toUpperCase
()
!=
cells
[
i
][
j
].
currentChar
.
toUpperCase
())
{
if
(
cells
[
i
][
j
].
actualChar
.
toUpperCase
()
!=
cells
[
i
][
j
].
currentChar
.
toUpperCase
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment