Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/

# IDE files
.vscode/
.idea/

# Visual Studio 2017 auto generated files
Generated\ Files/

Expand Down
64 changes: 35 additions & 29 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
"representer": false,
"analyzer": false
},
"test_runner": {
"average_run_time": 7
},
"blurb": "Visual Basic is an object-oriented programming language implemented on the .NET Framework.",
"version": 3,
"online_editor": {
"indent_style": "space",
"indent_size": 2,
"highlightjs_language": "vbnet"
},
"checklist_issue": 3,
"test_runner": {
"average_run_time": 7
},
"files": {
"solution": [
"%{pascal_slug}.vb"
Expand All @@ -37,7 +36,6 @@
]
},
"exercises": {
"concept": [],
"practice": [
{
"slug": "hello-world",
Expand Down Expand Up @@ -1037,6 +1035,15 @@
"slug": "beer-song",
"name": "Beer Song",
"uuid": "2523e11e-3a9e-4936-9cbb-37f53a6d90cb",
"practices": [],
"prerequisites": [],
"difficulty": 3,
"status": "deprecated"
},
{
"slug": "bottle-song",
"name": "Bottle Song",
"uuid": "7495b54e-0c0c-4e1f-af6a-f367402483b2",
"practices": [
"switch-statements",
"string-formatting"
Expand Down Expand Up @@ -1528,14 +1535,14 @@
"uuid": "2273d375-590c-44fb-bdcb-e67dcf64dfeb",
"practices": [
"for-loops",
"foreach-loops"
"foreach-loops"
],
"prerequisites": [
"strings",
"numbers",
"exceptions"
],
"difficulty": 4
"difficulty": 4
},
{
"slug": "zipper",
Expand Down Expand Up @@ -1609,55 +1616,54 @@
}
]
},
"concepts": [],
"key_features": [
{
"icon": "powerful",
"title": "Modern",
"content": "Visual Basic is a modern, powerful language."
"content": "Visual Basic is a modern, powerful language.",
"icon": "powerful"
},
{
"icon": "cross-platform",
"title": "Cross-platform",
"content": "Visual Basic runs on almost any platform and chipset."
"content": "Visual Basic runs on almost any platform and chipset.",
"icon": "cross-platform"
},
{
"icon": "multi-paradigm",
"title": "Multi-paradigm",
"content": "Visual Basic is primarily an object-oriented language, but also has lots of functional features."
"content": "Visual Basic is primarily an object-oriented language, but also has lots of functional features.",
"icon": "multi-paradigm"
},
{
"icon": "general-purpose",
"title": "General purpose",
"content": "Visual Basic is used for a wide variety of workloads, like websites, gui and console applications."
"content": "Visual Basic is used for a wide variety of workloads, like websites, gui and console applications.",
"icon": "general-purpose"
},
{
"icon": "tooling",
"title": "Tooling",
"content": "Visual Basic has excellent tooling, with linting and advanced refactoring options built-in."
"content": "Visual Basic has excellent tooling, with linting and advanced refactoring options built-in.",
"icon": "tooling"
},
{
"icon": "documentation",
"title": "Documentation",
"content": "Documentation is excellent and exhaustive, making it easy to get started with Visual Basic."
"content": "Documentation is excellent and exhaustive, making it easy to get started with Visual Basic.",
"icon": "documentation"
}
],
"tags": [
"execution_mode/compiled",
"paradigm/functional",
"paradigm/imperative",
"paradigm/object_oriented",
"typing/static",
"typing/strong",
"typing/dynamic",
"typing/weak",
"execution_mode/compiled",
"platform/windows",
"platform/mac",
"platform/linux",
"platform/ios",
"platform/android",
"platform/ios",
"platform/linux",
"platform/mac",
"platform/web",
"platform/windows",
"runtime/clr",
"typing/dynamic",
"typing/static",
"typing/strong",
"typing/weak",
"used_for/backends",
"used_for/cross_platform_development",
"used_for/frontends",
Expand Down
7 changes: 7 additions & 0 deletions exercises/Exercises.sln
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TwoBucket", "practice\two-b
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Tournament", "practice\tournament\Tournament.vbproj", "{7E2F5148-8DD5-4A9F-AA88-AB3FA83E7B5E}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BottleSong", "practice\bottle-song\BottleSong.vbproj", "{0624D9E6-2BC8-4B99-8836-762D2B426C28}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -620,6 +622,10 @@ Global
{7E2F5148-8DD5-4A9F-AA88-AB3FA83E7B5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E2F5148-8DD5-4A9F-AA88-AB3FA83E7B5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E2F5148-8DD5-4A9F-AA88-AB3FA83E7B5E}.Release|Any CPU.Build.0 = Release|Any CPU
{0624D9E6-2BC8-4B99-8836-762D2B426C28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0624D9E6-2BC8-4B99-8836-762D2B426C28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0624D9E6-2BC8-4B99-8836-762D2B426C28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0624D9E6-2BC8-4B99-8836-762D2B426C28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{ED3FEEC3-83E9-4C7F-BD51-0ABA9BCC102A} = {B161412A-37BB-42B7-9D8F-F4B238E3CFFA}
Expand Down Expand Up @@ -723,5 +729,6 @@ Global
{96476D25-FEAC-44A8-BA8D-D2C80DC2B680} = {B161412A-37BB-42B7-9D8F-F4B238E3CFFA}
{8C192C5E-8B2D-44ED-82B0-7ECF1D03DBB0} = {B161412A-37BB-42B7-9D8F-F4B238E3CFFA}
{7E2F5148-8DD5-4A9F-AA88-AB3FA83E7B5E} = {B161412A-37BB-42B7-9D8F-F4B238E3CFFA}
{0624D9E6-2BC8-4B99-8836-762D2B426C28} = {B161412A-37BB-42B7-9D8F-F4B238E3CFFA}
EndGlobalSection
EndGlobal
57 changes: 57 additions & 0 deletions exercises/practice/bottle-song/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Instructions

Recite the lyrics to that popular children's repetitive song: Ten Green Bottles.

Note that not all verses are identical.

```text
Ten green bottles hanging on the wall,
Ten green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be nine green bottles hanging on the wall.

Nine green bottles hanging on the wall,
Nine green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be eight green bottles hanging on the wall.

Eight green bottles hanging on the wall,
Eight green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be seven green bottles hanging on the wall.

Seven green bottles hanging on the wall,
Seven green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be six green bottles hanging on the wall.

Six green bottles hanging on the wall,
Six green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be five green bottles hanging on the wall.

Five green bottles hanging on the wall,
Five green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be four green bottles hanging on the wall.

Four green bottles hanging on the wall,
Four green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be three green bottles hanging on the wall.

Three green bottles hanging on the wall,
Three green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be two green bottles hanging on the wall.

Two green bottles hanging on the wall,
Two green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be one green bottle hanging on the wall.

One green bottle hanging on the wall,
One green bottle hanging on the wall,
And if one green bottle should accidentally fall,
There'll be no green bottles hanging on the wall.
```
54 changes: 54 additions & 0 deletions exercises/practice/bottle-song/.meta/Example.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Imports System
Imports System.Collections.Generic
Imports System.Linq

Public Module BottleSong
Public Function Recite(ByVal startBottles As Integer, ByVal takeDown As Integer) As String
Return String.Join(Environment.NewLine & Environment.NewLine, _
Enumerable.Range(startBottles - takeDown + 1, takeDown) _
.Reverse() _
.Select(Function(n) String.Join(Environment.NewLine, Verse(n))))
End Function

Private Function Verse(ByVal number As Integer) As List(Of String)
Dim bottles As String = If(number = 1, "bottle", "bottles")
Dim nextBottles As String = If((number - 1) = 1, "bottle", "bottles")
Dim currCount As String = DecimalToOrdinal(number)
Dim nextCount As String = DecimalToOrdinal(number - 1)
Return New List(Of String) From {
$"{currCount} green {bottles} hanging on the wall,",
$"{currCount} green {bottles} hanging on the wall,",
"And if one green bottle should accidentally fall,",
$"There'll be {nextCount.ToLowerInvariant()} green {nextBottles} hanging on the wall."
}
End Function

Private Function DecimalToOrdinal(ByVal number As Integer) As String
Select Case number
Case 0
Return "No"
Case 1
Return "One"
Case 2
Return "Two"
Case 3
Return "Three"
Case 4
Return "Four"
Case 5
Return "Five"
Case 6
Return "Six"
Case 7
Return "Seven"
Case 8
Return "Eight"
Case 9
Return "Nine"
Case 10
Return "Ten"
Case Else
Throw New NotImplementedException()
End Select
End Function
End Module
19 changes: 19 additions & 0 deletions exercises/practice/bottle-song/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"authors": [
"BNAndras"
],
"files": {
"solution": [
"BottleSong.vb"
],
"test": [
"BottleSongTests.vb"
],
"example": [
".meta/Example.vb"
]
},
"blurb": "Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.",
"source": "Wikipedia",
"source_url": "https://en.wikipedia.org/wiki/Ten_Green_Bottles"
}
31 changes: 31 additions & 0 deletions exercises/practice/bottle-song/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[d4ccf8fc-01dc-48c0-a201-4fbeb30f2d03]
description = "verse -> single verse -> first generic verse"

[0f0aded3-472a-4c64-b842-18d4f1f5f030]
description = "verse -> single verse -> last generic verse"

[f61f3c97-131f-459e-b40a-7428f3ed99d9]
description = "verse -> single verse -> verse with 2 bottles"

[05eadba9-5dbd-401e-a7e8-d17cc9baa8e0]
description = "verse -> single verse -> verse with 1 bottle"

[a4a28170-83d6-4dc1-bd8b-319b6abb6a80]
description = "lyrics -> multiple verses -> first two verses"

[3185d438-c5ac-4ce6-bcd3-02c9ff1ed8db]
description = "lyrics -> multiple verses -> last three verses"

[28c1584a-0e51-4b65-9ae2-fbc0bf4bbb28]
description = "lyrics -> multiple verses -> all verses"
7 changes: 7 additions & 0 deletions exercises/practice/bottle-song/BottleSong.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Imports System

Public Module BottleSong
Public Function Recite(ByVal startBottles As Integer, ByVal takeDown As Integer) As String
Throw New NotImplementedException("You need to implement this function.")
End Function
End Module
16 changes: 16 additions & 0 deletions exercises/practice/bottle-song/BottleSong.vbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
Loading
Loading