Skip to content

Commit 2e96e7e

Browse files
authored
Add files via upload
1 parent c9ce56c commit 2e96e7e

16 files changed

+1589
-0
lines changed

src/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

src/Connection.vb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Module Connection
2+
'Grid Size 7x4
3+
Public Const COLS As Integer = 7
4+
Public Const ROWS As Integer = 4
5+
6+
'IsOnlyOneSnake
7+
'To make sure all words are interlinked
8+
'Considering each letter as star, then comparing whether all connected to each other
9+
'Helpful to exclude puzzles where some words are outside of link
10+
'Mostly written by chatgpt, but tested properly to insure stability
11+
Function IsOnlyOneSnake(pattern(,) As Char) As Boolean
12+
Dim visited(ROWS, COLS) As Boolean
13+
Dim connected As Boolean = True
14+
For i As Integer = 0 To ROWS - 1
15+
For j As Integer = 0 To COLS - 1
16+
If Not (pattern(i, j) = " "c OrElse pattern(i, j) = "*"c) AndAlso Not visited(i, j) Then
17+
DFS(pattern, visited, i, j)
18+
If Not AllStarsConnected(visited, pattern) Then
19+
connected = False
20+
Exit For
21+
End If
22+
End If
23+
Next
24+
If Not connected Then
25+
Exit For
26+
End If
27+
Next
28+
Return connected
29+
End Function
30+
31+
Sub DFS(ByVal pattern(,) As Char, ByRef visited(,) As Boolean, ByVal row As Integer, ByVal col As Integer)
32+
Dim rowMoves() As Integer = {-1, 1, 0, 0}
33+
Dim colMoves() As Integer = {0, 0, -1, 1}
34+
visited(row, col) = True
35+
For i As Integer = 0 To 3
36+
Dim newRow As Integer = row + rowMoves(i)
37+
Dim newCol As Integer = col + colMoves(i)
38+
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
39+
DFS(pattern, visited, newRow, newCol)
40+
End If
41+
Next
42+
End Sub
43+
Function AllStarsConnected(ByVal visited(,) As Boolean, ByVal pattern(,) As Char) As Boolean
44+
For i As Integer = 0 To ROWS - 1
45+
For j As Integer = 0 To COLS - 1
46+
If visited(i, j) = False AndAlso Not (pattern(i, j) = " "c OrElse pattern(i, j) = "*"c) Then
47+
Return False
48+
End If
49+
Next
50+
Next
51+
Return True
52+
End Function
53+
End Module

src/CrossWord.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.33423.255
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CrossWord", "CrossWord.vbproj", "{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {DD256487-AACF-4220-A94E-A1761FB14046}
24+
EndGlobalSection
25+
EndGlobal

src/CrossWord.vbproj

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{D2A1FEDD-AABC-4FD8-8FCF-EC2D3546F5EF}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<StartupObject>CrossWord.My.MyApplication</StartupObject>
10+
<RootNamespace>CrossWord</RootNamespace>
11+
<AssemblyName>CrossWord</AssemblyName>
12+
<FileAlignment>512</FileAlignment>
13+
<MyType>WindowsForms</MyType>
14+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<DefineDebug>true</DefineDebug>
23+
<DefineTrace>true</DefineTrace>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DocumentationFile>CrossWord.xml</DocumentationFile>
26+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<DefineDebug>false</DefineDebug>
32+
<DefineTrace>true</DefineTrace>
33+
<Optimize>true</Optimize>
34+
<OutputPath>bin\Release\</OutputPath>
35+
<DocumentationFile>CrossWord.xml</DocumentationFile>
36+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
37+
</PropertyGroup>
38+
<PropertyGroup>
39+
<OptionExplicit>On</OptionExplicit>
40+
</PropertyGroup>
41+
<PropertyGroup>
42+
<OptionCompare>Binary</OptionCompare>
43+
</PropertyGroup>
44+
<PropertyGroup>
45+
<OptionStrict>Off</OptionStrict>
46+
</PropertyGroup>
47+
<PropertyGroup>
48+
<OptionInfer>On</OptionInfer>
49+
</PropertyGroup>
50+
<ItemGroup>
51+
<Reference Include="System" />
52+
<Reference Include="System.Data" />
53+
<Reference Include="System.Deployment" />
54+
<Reference Include="System.Drawing" />
55+
<Reference Include="System.Windows.Forms" />
56+
<Reference Include="System.Xml" />
57+
<Reference Include="System.Core" />
58+
<Reference Include="System.Xml.Linq" />
59+
<Reference Include="System.Data.DataSetExtensions" />
60+
<Reference Include="System.Net.Http" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<Import Include="Microsoft.VisualBasic" />
64+
<Import Include="System" />
65+
<Import Include="System.Collections" />
66+
<Import Include="System.Collections.Generic" />
67+
<Import Include="System.Data" />
68+
<Import Include="System.Drawing" />
69+
<Import Include="System.Diagnostics" />
70+
<Import Include="System.Windows.Forms" />
71+
<Import Include="System.Linq" />
72+
<Import Include="System.Xml.Linq" />
73+
<Import Include="System.Threading.Tasks" />
74+
</ItemGroup>
75+
<ItemGroup>
76+
<Compile Include="Connection.vb" />
77+
<Compile Include="Crossword.vb" />
78+
<Compile Include="LoadList.vb" />
79+
<Compile Include="Main.vb">
80+
<SubType>Form</SubType>
81+
</Compile>
82+
<Compile Include="Main.Designer.vb">
83+
<DependentUpon>Main.vb</DependentUpon>
84+
<SubType>Form</SubType>
85+
</Compile>
86+
<Compile Include="My Project\AssemblyInfo.vb" />
87+
<Compile Include="My Project\Application.Designer.vb">
88+
<AutoGen>True</AutoGen>
89+
<DependentUpon>Application.myapp</DependentUpon>
90+
</Compile>
91+
<Compile Include="My Project\Resources.Designer.vb">
92+
<AutoGen>True</AutoGen>
93+
<DesignTime>True</DesignTime>
94+
<DependentUpon>Resources.resx</DependentUpon>
95+
</Compile>
96+
<Compile Include="My Project\Settings.Designer.vb">
97+
<AutoGen>True</AutoGen>
98+
<DependentUpon>Settings.settings</DependentUpon>
99+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
100+
</Compile>
101+
</ItemGroup>
102+
<ItemGroup>
103+
<EmbeddedResource Include="Main.resx">
104+
<DependentUpon>Main.vb</DependentUpon>
105+
</EmbeddedResource>
106+
<EmbeddedResource Include="My Project\Resources.resx">
107+
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
108+
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
109+
<CustomToolNamespace>My.Resources</CustomToolNamespace>
110+
<SubType>Designer</SubType>
111+
</EmbeddedResource>
112+
</ItemGroup>
113+
<ItemGroup>
114+
<None Include="My Project\Application.myapp">
115+
<Generator>MyApplicationCodeGenerator</Generator>
116+
<LastGenOutput>Application.Designer.vb</LastGenOutput>
117+
</None>
118+
<None Include="My Project\Settings.settings">
119+
<Generator>SettingsSingleFileGenerator</Generator>
120+
<CustomToolNamespace>My</CustomToolNamespace>
121+
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
122+
</None>
123+
<None Include="App.config" />
124+
</ItemGroup>
125+
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
126+
</Project>

0 commit comments

Comments
 (0)