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
59e7a713
Commit
59e7a713
authored
3 months ago
by
Floris
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
9b5db69c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PuzzlePlayer/PuzzlePlayer.cs
+1
-1
1 addition, 1 deletion
PuzzlePlayer/PuzzlePlayer.cs
PuzzlePlayer/Skyscrapers.cs
+30
-8
30 additions, 8 deletions
PuzzlePlayer/Skyscrapers.cs
with
31 additions
and
9 deletions
PuzzlePlayer/PuzzlePlayer.cs
+
1
−
1
View file @
59e7a713
...
...
@@ -10,7 +10,7 @@ namespace PuzzlePlayer_Namespace
{
internal
static
void
Main
(
string
[]
args
)
{
Application
.
Run
(
new
PuzzleForm
(
new
Skyscrapers
()));
Application
.
Run
(
new
PuzzleForm
(
new
Skyscrapers
(
6
)));
}
}
...
...
This diff is collapsed.
Click to expand it.
PuzzlePlayer/Skyscrapers.cs
+
30
−
8
View file @
59e7a713
...
...
@@ -2,11 +2,13 @@
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing.Text
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Cryptography.Xml
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms.Design
;
namespace
PuzzlePlayer_Namespace
{
...
...
@@ -16,14 +18,18 @@ namespace PuzzlePlayer_Namespace
public
string
[,]
candidateState
;
public
Skyscrapers
(
int
boardSize
=
6
)
{
boardState
=
GetClearBoard
(
boardSize
);
lastGeneratedBoard
=
GetClearBoard
(
boardSize
);
candidateState
=
new
string
[
boardSize
,
boardSize
];
boardState
=
GetClearBoard
(
boardSize
+
2
);
lastGeneratedBoard
=
GetClearBoard
(
boardSize
+
2
);
candidateState
=
new
string
[
boardSize
+
2
,
boardSize
+
2
];
description
=
"lol"
;
drawFactor
=
1
;
candidateState
[
1
,
1
]
=
"123"
;
candidateState
[
2
,
3
]
=
"1734"
;
candidateState
[
4
,
4
]
=
"123456789"
;
boardState
[
1
,
1
]
=
1
;
boardState
[
2
,
2
]
=
2
;
boardState
[
3
,
3
]
=
3
;
boardState
[
4
,
4
]
=
4
;
}
public
override
void
Draw
(
Graphics
gr
,
Rectangle
r
)
{
...
...
@@ -90,13 +96,29 @@ namespace PuzzlePlayer_Namespace
public
override
void
Generate
()
{
int
[]
remaining
=
new
int
[
boardState
.
GetLength
(
0
)
]
;
for
(
int
i
=
0
;
i
<
remaining
.
Length
;
i
++)
remaining
[
i
]
=
i
+
1
;
for
(
int
i
=
0
;
i
<
boardState
.
GetLength
(
0
);
i
++
)
boardState
=
GetClearBoard
(
boardState
.
GetLength
(
0
)
)
;
candidateState
=
new
string
[
boardState
.
GetLength
(
0
),
boardState
.
GetLength
(
1
)];
Random
random
=
new
Random
()
;
void
RandomFillLine
(
int
direction
)
{
List
<
int
>
options
=
new
List
<
int
>();
for
(
int
i
=
0
;
i
<
boardState
.
GetLength
(
0
)
-
2
;
i
++)
options
.
Add
(
i
+
1
);
int
deficit
=
0
;
if
(
boardState
[
1
,
1
]
!=
emptySpace
)
{
options
.
Remove
(
boardState
[
1
,
1
]);
deficit
++;
}
for
(
int
i
=
deficit
;
i
<
boardState
.
GetLength
(
0
)
-
2
;
i
++)
{
int
index
=
random
.
Next
(
options
.
Count
);
boardState
[
1
+
i
*
(
1
-
direction
),
1
+
i
*
direction
]
=
options
[
index
];
options
.
RemoveAt
(
index
);
}
}
RandomFillLine
(
0
);
RandomFillLine
(
1
);
return
;
}
...
...
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