-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,589 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Module Connection | ||
'Grid Size 7x4 | ||
Public Const COLS As Integer = 7 | ||
Public Const ROWS As Integer = 4 | ||
|
||
'IsOnlyOneSnake | ||
'To make sure all words are interlinked | ||
'Considering each letter as star, then comparing whether all connected to each other | ||
'Helpful to exclude puzzles where some words are outside of link | ||
'Mostly written by chatgpt, but tested properly to insure stability | ||
Function IsOnlyOneSnake(pattern(,) As Char) As Boolean | ||
Dim visited(ROWS, COLS) As Boolean | ||
Dim connected As Boolean = True | ||
For i As Integer = 0 To ROWS - 1 | ||
For j As Integer = 0 To COLS - 1 | ||
If Not (pattern(i, j) = " "c OrElse pattern(i, j) = "*"c) AndAlso Not visited(i, j) Then | ||
DFS(pattern, visited, i, j) | ||
If Not AllStarsConnected(visited, pattern) Then | ||
connected = False | ||
Exit For | ||
End If | ||
End If | ||
Next | ||
If Not connected Then | ||
Exit For | ||
End If | ||
Next | ||
Return connected | ||
End Function | ||
|
||
Sub DFS(ByVal pattern(,) As Char, ByRef visited(,) As Boolean, ByVal row As Integer, ByVal col As Integer) | ||
Dim rowMoves() As Integer = {-1, 1, 0, 0} | ||
Dim colMoves() As Integer = {0, 0, -1, 1} | ||
visited(row, col) = True | ||
For i As Integer = 0 To 3 | ||
Dim newRow As Integer = row + rowMoves(i) | ||
Dim newCol As Integer = col + colMoves(i) | ||
If newRow >= 0 AndAlso newRow < ROWS AndAlso newCol >= 0 AndAlso newCol < COLS AndAlso Not (pattern(newRow, newCol) = " "c OrElse pattern(newRow, newCol) = "*"c) AndAlso Not visited(newRow, newCol) Then | ||
DFS(pattern, visited, newRow, newCol) | ||
End If | ||
Next | ||
End Sub | ||
Function AllStarsConnected(ByVal visited(,) As Boolean, ByVal pattern(,) As Char) As Boolean | ||
For i As Integer = 0 To ROWS - 1 | ||
For j As Integer = 0 To COLS - 1 | ||
If visited(i, j) = False AndAlso Not (pattern(i, j) = " "c OrElse pattern(i, j) = "*"c) Then | ||
Return False | ||
End If | ||
Next | ||
Next | ||
Return True | ||
End Function | ||
End Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.33423.255 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CrossWord", "CrossWord.vbproj", "{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {DD256487-AACF-4220-A94E-A1761FB14046} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<StartupObject>CrossWord.My.MyApplication</StartupObject> | ||
<RootNamespace>CrossWord</RootNamespace> | ||
<AssemblyName>CrossWord</AssemblyName> | ||
<FileAlignment>512</FileAlignment> | ||
<MyType>WindowsForms</MyType> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<DefineDebug>true</DefineDebug> | ||
<DefineTrace>true</DefineTrace> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DocumentationFile>CrossWord.xml</DocumentationFile> | ||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<DefineDebug>false</DefineDebug> | ||
<DefineTrace>true</DefineTrace> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DocumentationFile>CrossWord.xml</DocumentationFile> | ||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OptionExplicit>On</OptionExplicit> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OptionCompare>Binary</OptionCompare> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OptionStrict>Off</OptionStrict> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OptionInfer>On</OptionInfer> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Import Include="Microsoft.VisualBasic" /> | ||
<Import Include="System" /> | ||
<Import Include="System.Collections" /> | ||
<Import Include="System.Collections.Generic" /> | ||
<Import Include="System.Data" /> | ||
<Import Include="System.Drawing" /> | ||
<Import Include="System.Diagnostics" /> | ||
<Import Include="System.Windows.Forms" /> | ||
<Import Include="System.Linq" /> | ||
<Import Include="System.Xml.Linq" /> | ||
<Import Include="System.Threading.Tasks" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Connection.vb" /> | ||
<Compile Include="Crossword.vb" /> | ||
<Compile Include="LoadList.vb" /> | ||
<Compile Include="Main.vb"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="Main.Designer.vb"> | ||
<DependentUpon>Main.vb</DependentUpon> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="My Project\AssemblyInfo.vb" /> | ||
<Compile Include="My Project\Application.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Application.myapp</DependentUpon> | ||
</Compile> | ||
<Compile Include="My Project\Resources.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="My Project\Settings.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Main.resx"> | ||
<DependentUpon>Main.vb</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="My Project\Resources.resx"> | ||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.vb</LastGenOutput> | ||
<CustomToolNamespace>My.Resources</CustomToolNamespace> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="My Project\Application.myapp"> | ||
<Generator>MyApplicationCodeGenerator</Generator> | ||
<LastGenOutput>Application.Designer.vb</LastGenOutput> | ||
</None> | ||
<None Include="My Project\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<CustomToolNamespace>My</CustomToolNamespace> | ||
<LastGenOutput>Settings.Designer.vb</LastGenOutput> | ||
</None> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> | ||
</Project> |
Oops, something went wrong.