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
b639cb4d
Commit
b639cb4d
authored
1 month ago
by
PowerfulShuffle
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://git.science.uu.nl/8783497/puzzleplayer
parents
c7f685a1
9969000c
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/Board.cs
+33
-1
33 additions, 1 deletion
PuzzlePlayer/Board.cs
with
33 additions
and
1 deletion
PuzzlePlayer/Board.cs
+
33
−
1
View file @
b639cb4d
...
...
@@ -6,6 +6,8 @@ using System.Reflection.Metadata;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Diagnostics
;
using
static
System
.
Windows
.
Forms
.
VisualStyles
.
VisualStyleElement
.
Rebar
;
namespace
PuzzlePlayer_Namespace
{
...
...
@@ -102,7 +104,8 @@ namespace PuzzlePlayer_Namespace
}
// virtual method for solving one step
public
virtual
void
Hint
()
/*public virtual void Hint()
{
int row;
int col;
...
...
@@ -131,6 +134,35 @@ namespace PuzzlePlayer_Namespace
}
}
}
*/
public
virtual
void
Hint
()
{
List
<
Tuple
<
int
,
int
>>
emptySpaces
=
new
List
<
Tuple
<
int
,
int
>>();
for
(
int
x
=
0
;
x
<
boardState
.
GetLength
(
0
);
x
++)
{
for
(
int
y
=
0
;
y
<
boardState
.
GetLength
(
1
);
y
++)
{
if
(
boardState
[
x
,
y
]
==
emptySpace
)
{
emptySpaces
.
Add
(
new
Tuple
<
int
,
int
>(
x
,
y
));
}
}
}
if
(
emptySpaces
.
Count
>
0
)
{
int
index
=
random
.
Next
(
emptySpaces
.
Count
);
Tuple
<
int
,
int
>
randomEmptySpace
=
emptySpaces
[
index
];
int
row
=
randomEmptySpace
.
Item1
;
int
col
=
randomEmptySpace
.
Item2
;
boardState
[
row
,
col
]
=
solution
[
row
,
col
];
}
}
public
virtual
int
RandomNumber
(
int
number
)
{
...
...
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