Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
puzzleplayer
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Floris
puzzleplayer
Commits
218ec63c
Commit
218ec63c
authored
4 months ago
by
bionic85
Browse files
Options
Downloads
Patches
Plain Diff
We zijn Cooked
parent
a0ca0436
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PuzzlePlayer/Binary.cs
+36
-9
36 additions, 9 deletions
PuzzlePlayer/Binary.cs
with
36 additions
and
9 deletions
PuzzlePlayer/Binary.cs
+
36
−
9
View file @
218ec63c
...
...
@@ -151,13 +151,8 @@ namespace PuzzlePlayer_Namespace
for
(
int
j
=
0
;
j
<
board
.
GetLength
(
1
);
j
++)
{
// if the checked space is already filled in than it is not a valid move
if
(
board
[
i
,
j
]
!=
emptySpace
)
continue
;
if
(
SideCheck
(
i
,
j
,
board
,
checkFor
)
||
MiddleCheck
(
i
,
j
,
board
,
checkFor
))
continue
;
if
(
EvenCheck
(
i
,
j
,
board
,
checkFor
))
continue
;
//if (board[i, j] != emptySpace)
// continue;
/*
// if one of the checks succeeds then it is an invalid move
...
...
@@ -165,12 +160,40 @@ namespace PuzzlePlayer_Namespace
continue;
//*/
// if all checks pass then add the move to the list
choices
.
Add
(
new
Move
(
i
,
j
,
checkFor
));
if
(
board
[
i
,
j
]
==
emptySpace
&&
ValidChoiceCheck
(
i
,
j
,
board
,
checkFor
))
choices
.
Add
(
new
Move
(
i
,
j
,
checkFor
));
}
}
return
choices
;
}
private
static
bool
ValidChoiceCheck
(
int
x
,
int
y
,
int
[,]
board
,
int
checkFor
)
{
int
opposite
;
if
(
checkFor
==
0
)
opposite
=
1
;
else
opposite
=
0
;
if
(
SideCheck
(
x
,
y
,
board
,
checkFor
))
{
//Debug.WriteLine("side check. return false");
return
false
;
}
if
(
MiddleCheck
(
x
,
y
,
board
,
checkFor
))
{
//Debug.WriteLine("middle check. return false");
return
false
;
}
if
(
EvenCheck
(
x
,
y
,
board
,
checkFor
))
return
false
;
return
true
;
}
private
static
bool
IsBoardCompletlyFilledIn
(
int
[,]
board
)
{
for
(
int
i
=
0
;
i
<
board
.
GetLength
(
0
);
i
++)
...
...
@@ -215,7 +238,7 @@ namespace PuzzlePlayer_Namespace
// check if it is a valid move
if
(
DoAllChecks
(
x
,
y
,
boardToSolve
,
opposite
))
{
Debug
.
WriteLine
(
$"true
{
x
}
{
y
}
{
i
}
"
);
//
Debug.WriteLine($"true {x} {y} {i}");
return
new
Move
(
x
,
y
,
i
);
}
...
...
@@ -289,6 +312,10 @@ namespace PuzzlePlayer_Namespace
if
(
b
[
x
,
i
]
==
checkFor
)
countCol
++;
}
// if there are more counted then possible return false
if
((
countRow
)
>
b
.
GetLength
(
0
)
/
2
||
(
countCol
)
>
b
.
GetLength
(
0
)
/
2
)
return
false
;
// check if the total number of oppisite numbers is equal to half te widht/heigt
if
(
countRow
==
b
.
GetLength
(
0
)
/
2
||
countCol
==
b
.
GetLength
(
1
)
/
2
)
return
true
;
...
...
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