diff --git a/.gitignore b/.gitignore index 9d2b2e5..f2e4414 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/config.json b/config.json index 9742582..b994305 100644 --- a/config.json +++ b/config.json @@ -8,9 +8,6 @@ "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": { @@ -18,7 +15,9 @@ "indent_size": 2, "highlightjs_language": "vbnet" }, - "checklist_issue": 3, + "test_runner": { + "average_run_time": 7 + }, "files": { "solution": [ "%{pascal_slug}.vb" @@ -37,7 +36,6 @@ ] }, "exercises": { - "concept": [], "practice": [ { "slug": "hello-world", @@ -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" @@ -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", @@ -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", diff --git a/exercises/Exercises.sln b/exercises/Exercises.sln index fa7889c..b079820 100644 --- a/exercises/Exercises.sln +++ b/exercises/Exercises.sln @@ -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 @@ -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} @@ -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 diff --git a/exercises/practice/bottle-song/.docs/instructions.md b/exercises/practice/bottle-song/.docs/instructions.md new file mode 100644 index 0000000..febdfc8 --- /dev/null +++ b/exercises/practice/bottle-song/.docs/instructions.md @@ -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. +``` diff --git a/exercises/practice/bottle-song/.meta/Example.vb b/exercises/practice/bottle-song/.meta/Example.vb new file mode 100644 index 0000000..1a24681 --- /dev/null +++ b/exercises/practice/bottle-song/.meta/Example.vb @@ -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 \ No newline at end of file diff --git a/exercises/practice/bottle-song/.meta/config.json b/exercises/practice/bottle-song/.meta/config.json new file mode 100644 index 0000000..98e9c87 --- /dev/null +++ b/exercises/practice/bottle-song/.meta/config.json @@ -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" +} diff --git a/exercises/practice/bottle-song/.meta/tests.toml b/exercises/practice/bottle-song/.meta/tests.toml new file mode 100644 index 0000000..1f6e40a --- /dev/null +++ b/exercises/practice/bottle-song/.meta/tests.toml @@ -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" diff --git a/exercises/practice/bottle-song/BottleSong.vb b/exercises/practice/bottle-song/BottleSong.vb new file mode 100644 index 0000000..1c89ad5 --- /dev/null +++ b/exercises/practice/bottle-song/BottleSong.vb @@ -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 diff --git a/exercises/practice/bottle-song/BottleSong.vbproj b/exercises/practice/bottle-song/BottleSong.vbproj new file mode 100644 index 0000000..32f4044 --- /dev/null +++ b/exercises/practice/bottle-song/BottleSong.vbproj @@ -0,0 +1,16 @@ + + + + net7.0 + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + diff --git a/exercises/practice/bottle-song/BottleSongTests.vb b/exercises/practice/bottle-song/BottleSongTests.vb new file mode 100644 index 0000000..bdad146 --- /dev/null +++ b/exercises/practice/bottle-song/BottleSongTests.vb @@ -0,0 +1,133 @@ +Imports Xunit + +Public Class BottleSongTests + + Public Sub Single_verse_first_generic_verse() + Dim expected = _ + "Ten green bottles hanging on the wall," & vbLf & _ + "Ten green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be nine green bottles hanging on the wall." + Assert.Equal(expected, Recite(10, 1)) + End Sub + + + Public Sub Single_verse_last_generic_verse() + Dim expected = _ + "Three green bottles hanging on the wall," & vbLf & _ + "Three green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be two green bottles hanging on the wall." + Assert.Equal(expected, Recite(3, 1)) + End Sub + + + Public Sub Single_verse_verse_with_2_bottles() + Dim expected = _ + "Two green bottles hanging on the wall," & vbLf & _ + "Two green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be one green bottle hanging on the wall." + Assert.Equal(expected, Recite(2, 1)) + End Sub + + + Public Sub Single_verse_verse_with_1_bottle() + Dim expected = _ + "One green bottle hanging on the wall," & vbLf & _ + "One green bottle hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be no green bottles hanging on the wall." + Assert.Equal(expected, Recite(1, 1)) + End Sub + + + Public Sub Multiple_verses_first_two_verses() + Dim expected = _ + "Ten green bottles hanging on the wall," & vbLf & _ + "Ten green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be nine green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Nine green bottles hanging on the wall," & vbLf & _ + "Nine green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be eight green bottles hanging on the wall." + Assert.Equal(expected, Recite(10, 2)) + End Sub + + + Public Sub Multiple_verses_last_three_verses() + Dim expected = _ + "Three green bottles hanging on the wall," & vbLf & _ + "Three green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be two green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Two green bottles hanging on the wall," & vbLf & _ + "Two green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be one green bottle hanging on the wall." & vbLf & _ + vbLf & _ + "One green bottle hanging on the wall," & vbLf & _ + "One green bottle hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be no green bottles hanging on the wall." + Assert.Equal(expected, Recite(3, 3)) + End Sub + + + Public Sub Multiple_verses_all_verses() + Dim expected = _ + "Ten green bottles hanging on the wall," & vbLf & _ + "Ten green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be nine green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Nine green bottles hanging on the wall," & vbLf & _ + "Nine green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be eight green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Eight green bottles hanging on the wall," & vbLf & _ + "Eight green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be seven green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Seven green bottles hanging on the wall," & vbLf & _ + "Seven green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be six green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Six green bottles hanging on the wall," & vbLf & _ + "Six green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be five green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Five green bottles hanging on the wall," & vbLf & _ + "Five green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be four green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Four green bottles hanging on the wall," & vbLf & _ + "Four green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be three green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Three green bottles hanging on the wall," & vbLf & _ + "Three green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be two green bottles hanging on the wall." & vbLf & _ + vbLf & _ + "Two green bottles hanging on the wall," & vbLf & _ + "Two green bottles hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be one green bottle hanging on the wall." & vbLf & _ + vbLf & _ + "One green bottle hanging on the wall," & vbLf & _ + "One green bottle hanging on the wall," & vbLf & _ + "And if one green bottle should accidentally fall," & vbLf & _ + "There'll be no green bottles hanging on the wall." + Assert.Equal(expected, Recite(10, 10)) + End Sub +End Class \ No newline at end of file