From e7dcb4c21203cf3d0e76a92159bb6ce483202095 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 3 Jul 2021 21:35:57 +0800 Subject: [PATCH 01/12] collatz conjecture initial --- config.json | 15 ++++++++ .../collatz-conjecture/.docs/instructions.md | 27 ++++++++++++++ .../collatz-conjecture/.meta/Example.vb | 28 ++++++++++++++ .../collatz-conjecture/.meta/config.json | 20 ++++++++++ .../collatz-conjecture/.meta/tests.toml | 28 ++++++++++++++ .../collatz-conjecture/CollatzConjecture.vb | 7 ++++ .../CollatzConjecture.vbproj | 17 +++++++++ .../CollatzConjectureTests.vb | 28 ++++++++++++++ exercises/practice/leap/.meta/tests.toml | 37 +++++++++++++++++++ .../reverse-string/ReverseStringTest.vb | 27 -------------- 10 files changed, 207 insertions(+), 27 deletions(-) create mode 100644 exercises/practice/collatz-conjecture/.docs/instructions.md create mode 100644 exercises/practice/collatz-conjecture/.meta/Example.vb create mode 100644 exercises/practice/collatz-conjecture/.meta/config.json create mode 100644 exercises/practice/collatz-conjecture/.meta/tests.toml create mode 100644 exercises/practice/collatz-conjecture/CollatzConjecture.vb create mode 100644 exercises/practice/collatz-conjecture/CollatzConjecture.vbproj create mode 100644 exercises/practice/collatz-conjecture/CollatzConjectureTests.vb create mode 100644 exercises/practice/leap/.meta/tests.toml delete mode 100644 exercises/practice/reverse-string/ReverseStringTest.vb diff --git a/config.json b/config.json index 5f58c5d9..2a71c0fb 100644 --- a/config.json +++ b/config.json @@ -180,6 +180,21 @@ "conditionals", "integers" ] + }, + { + "slug": "collatz-conjecture", + "name": "Collatz Conjecture", + "uuid": "751e4fea-1ee7-4c66-ba2b-802f3ab5f7d6", + "practices": [], + "prerequisites": [], + "difficulty": 2, + "topics": [ + "algorithms", + "conditionals", + "integers", + "loops", + "math" + ] } ] }, diff --git a/exercises/practice/collatz-conjecture/.docs/instructions.md b/exercises/practice/collatz-conjecture/.docs/instructions.md new file mode 100644 index 00000000..f8c76e7f --- /dev/null +++ b/exercises/practice/collatz-conjecture/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +The Collatz Conjecture or 3x+1 problem can be summarized as follows: + +Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is +odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely. +The conjecture states that no matter which number you start with, you will +always reach 1 eventually. + +Given a number n, return the number of steps required to reach 1. + +## Examples + +Starting with n = 12, the steps would be as follows: + +0. 12 +1. 6 +2. 3 +3. 10 +4. 5 +5. 16 +6. 8 +7. 4 +8. 2 +9. 1 + +Resulting in 9 steps. So for input n = 12, the return value would be 9. diff --git a/exercises/practice/collatz-conjecture/.meta/Example.vb b/exercises/practice/collatz-conjecture/.meta/Example.vb new file mode 100644 index 00000000..551e648e --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/Example.vb @@ -0,0 +1,28 @@ +Imports System + +Public Module CollatzConjecture + Private stepCount As Integer + + Private Sub Collatz(ByVal number As Integer) + If number Mod 2 = 0 Then + stepCount += 1 + Collatz(number / 2) + Else + + If number > 1 Then + stepCount += 1 + Collatz(number * 3 + 1) + End If + End If + End Sub + + Public Function Steps(ByVal number As Integer) As Integer + If number <= 0 Then + Throw New ArgumentOutOfRangeException() + End If + + stepCount = 0 + Collatz(number) + Return stepCount + End Function +End Module \ No newline at end of file diff --git a/exercises/practice/collatz-conjecture/.meta/config.json b/exercises/practice/collatz-conjecture/.meta/config.json new file mode 100644 index 00000000..b4f93239 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/config.json @@ -0,0 +1,20 @@ +{ + "blurb": "Calculate the number of steps to reach 1 using the Collatz conjecture", + "authors": [ + "axtens" + ], + "contributors": [], + "files": { + "solution": [ + "CollatzConjecture.vb" + ], + "test": [ + "CollatzConjectureTests.vb" + ], + "example": [ + ".meta/Example.vb" + ] + }, + "source": "An unsolved problem in mathematics named after mathematician Lothar Collatz", + "source_url": "https://en.wikipedia.org/wiki/3x_%2B_1_problem" + } \ No newline at end of file diff --git a/exercises/practice/collatz-conjecture/.meta/tests.toml b/exercises/practice/collatz-conjecture/.meta/tests.toml new file mode 100644 index 00000000..819b8d93 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/tests.toml @@ -0,0 +1,28 @@ +# 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. + +[540a3d51-e7a6-47a5-92a3-4ad1838f0bfd] +description = "zero steps for one" + +[3d76a0a6-ea84-444a-821a-f7857c2c1859] +description = "divide if even" + +[754dea81-123c-429e-b8bc-db20b05a87b9] +description = "even and odd steps" + +[ecfd0210-6f85-44f6-8280-f65534892ff6] +description = "large number of even and odd steps" + +[7d4750e6-def9-4b86-aec7-9f7eb44f95a3] +description = "zero is an error" + +[c6c795bf-a288-45e9-86a1-841359ad426d] +description = "negative value is an error" diff --git a/exercises/practice/collatz-conjecture/CollatzConjecture.vb b/exercises/practice/collatz-conjecture/CollatzConjecture.vb new file mode 100644 index 00000000..e48e83d7 --- /dev/null +++ b/exercises/practice/collatz-conjecture/CollatzConjecture.vb @@ -0,0 +1,7 @@ +Imports System + +Public Module CollatzConjecture + Public Function Steps(ByVal number As Integer) As Integer + Throw New NotImplementedException("Delete this statement and write your own implementation here") + End Function +End Module \ No newline at end of file diff --git a/exercises/practice/collatz-conjecture/CollatzConjecture.vbproj b/exercises/practice/collatz-conjecture/CollatzConjecture.vbproj new file mode 100644 index 00000000..4195c3cb --- /dev/null +++ b/exercises/practice/collatz-conjecture/CollatzConjecture.vbproj @@ -0,0 +1,17 @@ + + + + net5.0 + + + + + + + + + + + + + \ No newline at end of file diff --git a/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb b/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb new file mode 100644 index 00000000..c6def4ae --- /dev/null +++ b/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb @@ -0,0 +1,28 @@ +Imports System +Imports Xunit +Public Class CollatzConjectureTests + + Public Sub ZeroStepsForOne() + Assert.Equal(0, Steps(1)) + End Sub + + Public Sub DivideIfEven() + Assert.Equal(4, Steps(16)) + End Sub + + Public Sub EvenAndOddSteps() + Assert.Equal(9, Steps(12)) + End Sub + + Public Sub LargeNumberOfEvenAndOddSteps() + Assert.Equal(152, Steps(1000000)) + End Sub + + Public Sub ZeroIsAnError() + Assert.Throws(Of ArgumentOutOfRangeException)(Function() Steps(0)) + End Sub + + Public Sub NegativeValueIsAnError() + Assert.Throws(Of ArgumentOutOfRangeException)(Function() Steps(-15)) + End Sub +End Class \ No newline at end of file diff --git a/exercises/practice/leap/.meta/tests.toml b/exercises/practice/leap/.meta/tests.toml new file mode 100644 index 00000000..ce6ba325 --- /dev/null +++ b/exercises/practice/leap/.meta/tests.toml @@ -0,0 +1,37 @@ +# 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. + +[6466b30d-519c-438e-935d-388224ab5223] +description = "year not divisible by 4 in common year" + +[ac227e82-ee82-4a09-9eb6-4f84331ffdb0] +description = "year divisible by 2, not divisible by 4 in common year" + +[4fe9b84c-8e65-489e-970b-856d60b8b78e] +description = "year divisible by 4, not divisible by 100 in leap year" + +[7fc6aed7-e63c-48f5-ae05-5fe182f60a5d] +description = "year divisible by 4 and 5 is still a leap year" + +[78a7848f-9667-4192-ae53-87b30c9a02dd] +description = "year divisible by 100, not divisible by 400 in common year" + +[9d70f938-537c-40a6-ba19-f50739ce8bac] +description = "year divisible by 100 but not by 3 is still not a leap year" + +[42ee56ad-d3e6-48f1-8e3f-c84078d916fc] +description = "year divisible by 400 is leap year" + +[57902c77-6fe9-40de-8302-587b5c27121e] +description = "year divisible by 400 but not by 125 is still a leap year" + +[c30331f6-f9f6-4881-ad38-8ca8c12520c1] +description = "year divisible by 200, not divisible by 400 in common year" diff --git a/exercises/practice/reverse-string/ReverseStringTest.vb b/exercises/practice/reverse-string/ReverseStringTest.vb deleted file mode 100644 index 56695a9f..00000000 --- a/exercises/practice/reverse-string/ReverseStringTest.vb +++ /dev/null @@ -1,27 +0,0 @@ -Imports Xunit -Public Class ReverseStringTests - - Public Sub An_empty_string() - Assert.Equal("", ReverseString.Reverse("")) - End Sub - - Public Sub A_word() - Assert.Equal("tobor", ReverseString.Reverse("robot")) - End Sub - - Public Sub A_capitalized_word() - Assert.Equal("nemaR", ReverseString.Reverse("Ramen")) - End Sub - - Public Sub A_sentence_with_punctuation() - Assert.Equal("!yrgnuh m'I", ReverseString.Reverse("I'm hungry!")) - End Sub - - Public Sub A_palindrome() - Assert.Equal("racecar", ReverseString.Reverse("racecar")) - End Sub - - Public Sub An_even_sized_word() - Assert.Equal("reward", ReverseString.Reverse("drawer")) - End Sub -End Class From e2fffcaf736415a4f12c09e0434bfe1e80348ddd Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 3 Jul 2021 21:39:03 +0800 Subject: [PATCH 02/12] tests pass. some tests skipped. --- .../collatz-conjecture/CollatzConjectureTests.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb b/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb index c6def4ae..60390669 100644 --- a/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb +++ b/exercises/practice/collatz-conjecture/CollatzConjectureTests.vb @@ -5,23 +5,23 @@ Public Class CollatzConjectureTests Public Sub ZeroStepsForOne() Assert.Equal(0, Steps(1)) End Sub - + Public Sub DivideIfEven() Assert.Equal(4, Steps(16)) End Sub - + Public Sub EvenAndOddSteps() Assert.Equal(9, Steps(12)) End Sub - + Public Sub LargeNumberOfEvenAndOddSteps() Assert.Equal(152, Steps(1000000)) End Sub - + Public Sub ZeroIsAnError() Assert.Throws(Of ArgumentOutOfRangeException)(Function() Steps(0)) End Sub - + Public Sub NegativeValueIsAnError() Assert.Throws(Of ArgumentOutOfRangeException)(Function() Steps(-15)) End Sub From 5ee22359ffcc89ddd45281cb2908a3be9d7c8527 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Thu, 8 Jul 2021 22:01:21 +0800 Subject: [PATCH 03/12] high-scores --- config.json | 19 +++ .../high-scores/.docs/instructions.md | 5 + .../practice/high-scores/.meta/Example.vb | 30 +++++ .../practice/high-scores/.meta/config.json | 19 +++ .../practice/high-scores/.meta/tests.toml | 40 +++++++ exercises/practice/high-scores/HighScores.vb | 20 ++++ .../practice/high-scores/HighScores.vbproj | 17 +++ .../practice/high-scores/HighScoresTests.vb | 108 ++++++++++++++++++ 8 files changed, 258 insertions(+) create mode 100644 exercises/practice/high-scores/.docs/instructions.md create mode 100644 exercises/practice/high-scores/.meta/Example.vb create mode 100644 exercises/practice/high-scores/.meta/config.json create mode 100644 exercises/practice/high-scores/.meta/tests.toml create mode 100644 exercises/practice/high-scores/HighScores.vb create mode 100644 exercises/practice/high-scores/HighScores.vbproj create mode 100644 exercises/practice/high-scores/HighScoresTests.vb diff --git a/config.json b/config.json index 1a1f5023..2b8140a2 100644 --- a/config.json +++ b/config.json @@ -270,6 +270,25 @@ "parsing", "transforming" ] + }, + { + "slug": "high-scores", + "name": "High Scores", + "uuid": "ace0e76d-d272-4349-badb-80720447b78a", + "practices": [ + "lists", + "ordering" + ], + "prerequisites": [ + "lists", + "ordering", + "constructors", + "numbers" + ], + "difficulty": 1, + "topics": [ + "lists" + ] } ] }, diff --git a/exercises/practice/high-scores/.docs/instructions.md b/exercises/practice/high-scores/.docs/instructions.md new file mode 100644 index 00000000..1f8154d5 --- /dev/null +++ b/exercises/practice/high-scores/.docs/instructions.md @@ -0,0 +1,5 @@ +# Instructions + +Manage a game player's High Score list. + +Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. diff --git a/exercises/practice/high-scores/.meta/Example.vb b/exercises/practice/high-scores/.meta/Example.vb new file mode 100644 index 00000000..43763f5c --- /dev/null +++ b/exercises/practice/high-scores/.meta/Example.vb @@ -0,0 +1,30 @@ +Imports System +Imports System.Collections.Generic +Imports System.Linq + +Public Class HighScores + Private scoresField = New List(Of Integer) + + Public Sub New(ByVal list As List(Of Integer)) + scoresField = list + End Sub + + Public Function Scores() As List(Of Integer) + Return scoresField + End Function + + Public Function Latest() As Integer + Return Enumerable.Last(scoresField) + End Function + + Public Function PersonalBest() As Integer + Return Enumerable.Max(scoresField) + End Function + + Public Function PersonalTopThree() As List(Of Integer) + Return (From score + In scores + Order By -score + Select score).Take(3).ToList() + End Function +End Class diff --git a/exercises/practice/high-scores/.meta/config.json b/exercises/practice/high-scores/.meta/config.json new file mode 100644 index 00000000..d1d58c75 --- /dev/null +++ b/exercises/practice/high-scores/.meta/config.json @@ -0,0 +1,19 @@ +{ + "blurb": "Manage a player's High Score list", + "authors": [ + "axtens" + ], + "contributors": [], + "files": { + "solution": [ + "HighScores.vb" + ], + "test": [ + "HighScoresTests.vb" + ], + "example": [ + ".meta/Example.vb" + ] + }, + "source": "Tribute to the eighties' arcade game Frogger" + } \ No newline at end of file diff --git a/exercises/practice/high-scores/.meta/tests.toml b/exercises/practice/high-scores/.meta/tests.toml new file mode 100644 index 00000000..c81c2288 --- /dev/null +++ b/exercises/practice/high-scores/.meta/tests.toml @@ -0,0 +1,40 @@ +# 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. + +[1035eb93-2208-4c22-bab8-fef06769a73c] +description = "List of scores" + +[6aa5dbf5-78fa-4375-b22c-ffaa989732d2] +description = "Latest score" + +[b661a2e1-aebf-4f50-9139-0fb817dd12c6] +description = "Personal best" + +[3d996a97-c81c-4642-9afc-80b80dc14015] +description = "Top 3 scores -> Personal top three from a list of scores" + +[1084ecb5-3eb4-46fe-a816-e40331a4e83a] +description = "Top 3 scores -> Personal top highest to lowest" + +[e6465b6b-5a11-4936-bfe3-35241c4f4f16] +description = "Top 3 scores -> Personal top when there is a tie" + +[f73b02af-c8fd-41c9-91b9-c86eaa86bce2] +description = "Top 3 scores -> Personal top when there are less than 3" + +[16608eae-f60f-4a88-800e-aabce5df2865] +description = "Top 3 scores -> Personal top when there is only one" + +[2df075f9-fec9-4756-8f40-98c52a11504f] +description = "Top 3 scores -> Latest score after personal top scores" + +[809c4058-7eb1-4206-b01e-79238b9b71bc] +description = "Top 3 scores -> Scores after personal top scores" diff --git a/exercises/practice/high-scores/HighScores.vb b/exercises/practice/high-scores/HighScores.vb new file mode 100644 index 00000000..5bb4a0d4 --- /dev/null +++ b/exercises/practice/high-scores/HighScores.vb @@ -0,0 +1,20 @@ +Imports System +Imports System.Linq + +Public Class HighScores + Public Function Scores() As List(Of Integer) + Throw New NotImplementedException("You need to implement this function") + End Function + + Public Function Latest() As Integer + Throw New NotImplementedException("You need to implement this function") + End Function.. + + Public Function PersonalBest() As Integer + Throw New NotImplementedException("You need to implement this function") + End Function + + Public Function PersonalTopThree() As List(Of Integer) + Throw New NotImplementedException("You need to implement this function") + End Function +End Class diff --git a/exercises/practice/high-scores/HighScores.vbproj b/exercises/practice/high-scores/HighScores.vbproj new file mode 100644 index 00000000..3529b968 --- /dev/null +++ b/exercises/practice/high-scores/HighScores.vbproj @@ -0,0 +1,17 @@ + + + + net5.0 + + + + + + + + + + + + + diff --git a/exercises/practice/high-scores/HighScoresTests.vb b/exercises/practice/high-scores/HighScoresTests.vb new file mode 100644 index 00000000..a98cc270 --- /dev/null +++ b/exercises/practice/high-scores/HighScoresTests.vb @@ -0,0 +1,108 @@ +Imports System.Collections.Generic +Imports Xunit +Public Class HighScoresTest + + Public Sub ListOfScores() + Dim sut = New HighScores(New List(Of Integer) From { + 30, + 50, + 20, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 30, + 50, + 20, + 70 + }, sut.Scores()) + End Sub + + Public Sub LatestScore() + Dim sut = New HighScores(New List(Of Integer) From { + 100, + 0, + 90, + 30 + }) + Assert.Equal(30, sut.Latest()) + End Sub + + Public Sub PersonalBest() + Dim sut = New HighScores(New List(Of Integer) From { + 40, + 100, + 70 + }) + Assert.Equal(100, sut.PersonalBest()) + End Sub + + Public Sub PersonalTopThreeFromAListOfScores() + Dim sut = New HighScores(New List(Of Integer) From { + 10, + 30, + 90, + 30, + 100, + 20, + 10, + 0, + 30, + 40, + 40, + 70, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 100, + 90, + 70 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopHighestToLowest() + Dim sut = New HighScores(New List(Of Integer) From { + 20, + 10, + 30 + }) + Assert.Equal(New List(Of Integer) From { + 30, + 20, + 10 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereIsATie() + Dim sut = New HighScores(New List(Of Integer) From { + 40, + 20, + 40, + 30 + }) + Assert.Equal(New List(Of Integer) From { + 40, + 40, + 30 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereAreLessThan3() + Dim sut = New HighScores(New List(Of Integer) From { + 30, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 70, + 30 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereIsOnlyOne() + Dim sut = New HighScores(New List(Of Integer) From { + 40 + }) + Assert.Equal(New List(Of Integer) From { + 40 + }, sut.PersonalTopThree()) + End Sub +End Class \ No newline at end of file From f848b51bffa33772ef9983c65934fc0031a2735a Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:02:48 +0800 Subject: [PATCH 04/12] no high-scores --- .../high-scores/.docs/instructions.md | 5 - .../practice/high-scores/.meta/Example.vb | 30 ----- .../practice/high-scores/.meta/config.json | 19 --- .../practice/high-scores/.meta/tests.toml | 40 ------- exercises/practice/high-scores/HighScores.vb | 20 ---- .../practice/high-scores/HighScores.vbproj | 17 --- .../practice/high-scores/HighScoresTests.vb | 108 ------------------ 7 files changed, 239 deletions(-) delete mode 100644 exercises/practice/high-scores/.docs/instructions.md delete mode 100644 exercises/practice/high-scores/.meta/Example.vb delete mode 100644 exercises/practice/high-scores/.meta/config.json delete mode 100644 exercises/practice/high-scores/.meta/tests.toml delete mode 100644 exercises/practice/high-scores/HighScores.vb delete mode 100644 exercises/practice/high-scores/HighScores.vbproj delete mode 100644 exercises/practice/high-scores/HighScoresTests.vb diff --git a/exercises/practice/high-scores/.docs/instructions.md b/exercises/practice/high-scores/.docs/instructions.md deleted file mode 100644 index 1f8154d5..00000000 --- a/exercises/practice/high-scores/.docs/instructions.md +++ /dev/null @@ -1,5 +0,0 @@ -# Instructions - -Manage a game player's High Score list. - -Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. diff --git a/exercises/practice/high-scores/.meta/Example.vb b/exercises/practice/high-scores/.meta/Example.vb deleted file mode 100644 index 43763f5c..00000000 --- a/exercises/practice/high-scores/.meta/Example.vb +++ /dev/null @@ -1,30 +0,0 @@ -Imports System -Imports System.Collections.Generic -Imports System.Linq - -Public Class HighScores - Private scoresField = New List(Of Integer) - - Public Sub New(ByVal list As List(Of Integer)) - scoresField = list - End Sub - - Public Function Scores() As List(Of Integer) - Return scoresField - End Function - - Public Function Latest() As Integer - Return Enumerable.Last(scoresField) - End Function - - Public Function PersonalBest() As Integer - Return Enumerable.Max(scoresField) - End Function - - Public Function PersonalTopThree() As List(Of Integer) - Return (From score - In scores - Order By -score - Select score).Take(3).ToList() - End Function -End Class diff --git a/exercises/practice/high-scores/.meta/config.json b/exercises/practice/high-scores/.meta/config.json deleted file mode 100644 index d1d58c75..00000000 --- a/exercises/practice/high-scores/.meta/config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "blurb": "Manage a player's High Score list", - "authors": [ - "axtens" - ], - "contributors": [], - "files": { - "solution": [ - "HighScores.vb" - ], - "test": [ - "HighScoresTests.vb" - ], - "example": [ - ".meta/Example.vb" - ] - }, - "source": "Tribute to the eighties' arcade game Frogger" - } \ No newline at end of file diff --git a/exercises/practice/high-scores/.meta/tests.toml b/exercises/practice/high-scores/.meta/tests.toml deleted file mode 100644 index c81c2288..00000000 --- a/exercises/practice/high-scores/.meta/tests.toml +++ /dev/null @@ -1,40 +0,0 @@ -# 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. - -[1035eb93-2208-4c22-bab8-fef06769a73c] -description = "List of scores" - -[6aa5dbf5-78fa-4375-b22c-ffaa989732d2] -description = "Latest score" - -[b661a2e1-aebf-4f50-9139-0fb817dd12c6] -description = "Personal best" - -[3d996a97-c81c-4642-9afc-80b80dc14015] -description = "Top 3 scores -> Personal top three from a list of scores" - -[1084ecb5-3eb4-46fe-a816-e40331a4e83a] -description = "Top 3 scores -> Personal top highest to lowest" - -[e6465b6b-5a11-4936-bfe3-35241c4f4f16] -description = "Top 3 scores -> Personal top when there is a tie" - -[f73b02af-c8fd-41c9-91b9-c86eaa86bce2] -description = "Top 3 scores -> Personal top when there are less than 3" - -[16608eae-f60f-4a88-800e-aabce5df2865] -description = "Top 3 scores -> Personal top when there is only one" - -[2df075f9-fec9-4756-8f40-98c52a11504f] -description = "Top 3 scores -> Latest score after personal top scores" - -[809c4058-7eb1-4206-b01e-79238b9b71bc] -description = "Top 3 scores -> Scores after personal top scores" diff --git a/exercises/practice/high-scores/HighScores.vb b/exercises/practice/high-scores/HighScores.vb deleted file mode 100644 index 5bb4a0d4..00000000 --- a/exercises/practice/high-scores/HighScores.vb +++ /dev/null @@ -1,20 +0,0 @@ -Imports System -Imports System.Linq - -Public Class HighScores - Public Function Scores() As List(Of Integer) - Throw New NotImplementedException("You need to implement this function") - End Function - - Public Function Latest() As Integer - Throw New NotImplementedException("You need to implement this function") - End Function.. - - Public Function PersonalBest() As Integer - Throw New NotImplementedException("You need to implement this function") - End Function - - Public Function PersonalTopThree() As List(Of Integer) - Throw New NotImplementedException("You need to implement this function") - End Function -End Class diff --git a/exercises/practice/high-scores/HighScores.vbproj b/exercises/practice/high-scores/HighScores.vbproj deleted file mode 100644 index 3529b968..00000000 --- a/exercises/practice/high-scores/HighScores.vbproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - diff --git a/exercises/practice/high-scores/HighScoresTests.vb b/exercises/practice/high-scores/HighScoresTests.vb deleted file mode 100644 index a98cc270..00000000 --- a/exercises/practice/high-scores/HighScoresTests.vb +++ /dev/null @@ -1,108 +0,0 @@ -Imports System.Collections.Generic -Imports Xunit -Public Class HighScoresTest - - Public Sub ListOfScores() - Dim sut = New HighScores(New List(Of Integer) From { - 30, - 50, - 20, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 30, - 50, - 20, - 70 - }, sut.Scores()) - End Sub - - Public Sub LatestScore() - Dim sut = New HighScores(New List(Of Integer) From { - 100, - 0, - 90, - 30 - }) - Assert.Equal(30, sut.Latest()) - End Sub - - Public Sub PersonalBest() - Dim sut = New HighScores(New List(Of Integer) From { - 40, - 100, - 70 - }) - Assert.Equal(100, sut.PersonalBest()) - End Sub - - Public Sub PersonalTopThreeFromAListOfScores() - Dim sut = New HighScores(New List(Of Integer) From { - 10, - 30, - 90, - 30, - 100, - 20, - 10, - 0, - 30, - 40, - 40, - 70, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 100, - 90, - 70 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopHighestToLowest() - Dim sut = New HighScores(New List(Of Integer) From { - 20, - 10, - 30 - }) - Assert.Equal(New List(Of Integer) From { - 30, - 20, - 10 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereIsATie() - Dim sut = New HighScores(New List(Of Integer) From { - 40, - 20, - 40, - 30 - }) - Assert.Equal(New List(Of Integer) From { - 40, - 40, - 30 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereAreLessThan3() - Dim sut = New HighScores(New List(Of Integer) From { - 30, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 70, - 30 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereIsOnlyOne() - Dim sut = New HighScores(New List(Of Integer) From { - 40 - }) - Assert.Equal(New List(Of Integer) From { - 40 - }, sut.PersonalTopThree()) - End Sub -End Class \ No newline at end of file From 6cc5927dc5f047012ee0100c56fb8b694ab950e0 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:04:52 +0800 Subject: [PATCH 05/12] back again --- exercises/practice/high-scores/HighScores.vb | 20 ++++ .../practice/high-scores/HighScores.vbproj | 17 +++ .../practice/high-scores/HighScoresTests.vb | 108 ++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 exercises/practice/high-scores/HighScores.vb create mode 100644 exercises/practice/high-scores/HighScores.vbproj create mode 100644 exercises/practice/high-scores/HighScoresTests.vb diff --git a/exercises/practice/high-scores/HighScores.vb b/exercises/practice/high-scores/HighScores.vb new file mode 100644 index 00000000..5bb4a0d4 --- /dev/null +++ b/exercises/practice/high-scores/HighScores.vb @@ -0,0 +1,20 @@ +Imports System +Imports System.Linq + +Public Class HighScores + Public Function Scores() As List(Of Integer) + Throw New NotImplementedException("You need to implement this function") + End Function + + Public Function Latest() As Integer + Throw New NotImplementedException("You need to implement this function") + End Function.. + + Public Function PersonalBest() As Integer + Throw New NotImplementedException("You need to implement this function") + End Function + + Public Function PersonalTopThree() As List(Of Integer) + Throw New NotImplementedException("You need to implement this function") + End Function +End Class diff --git a/exercises/practice/high-scores/HighScores.vbproj b/exercises/practice/high-scores/HighScores.vbproj new file mode 100644 index 00000000..3529b968 --- /dev/null +++ b/exercises/practice/high-scores/HighScores.vbproj @@ -0,0 +1,17 @@ + + + + net5.0 + + + + + + + + + + + + + diff --git a/exercises/practice/high-scores/HighScoresTests.vb b/exercises/practice/high-scores/HighScoresTests.vb new file mode 100644 index 00000000..a98cc270 --- /dev/null +++ b/exercises/practice/high-scores/HighScoresTests.vb @@ -0,0 +1,108 @@ +Imports System.Collections.Generic +Imports Xunit +Public Class HighScoresTest + + Public Sub ListOfScores() + Dim sut = New HighScores(New List(Of Integer) From { + 30, + 50, + 20, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 30, + 50, + 20, + 70 + }, sut.Scores()) + End Sub + + Public Sub LatestScore() + Dim sut = New HighScores(New List(Of Integer) From { + 100, + 0, + 90, + 30 + }) + Assert.Equal(30, sut.Latest()) + End Sub + + Public Sub PersonalBest() + Dim sut = New HighScores(New List(Of Integer) From { + 40, + 100, + 70 + }) + Assert.Equal(100, sut.PersonalBest()) + End Sub + + Public Sub PersonalTopThreeFromAListOfScores() + Dim sut = New HighScores(New List(Of Integer) From { + 10, + 30, + 90, + 30, + 100, + 20, + 10, + 0, + 30, + 40, + 40, + 70, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 100, + 90, + 70 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopHighestToLowest() + Dim sut = New HighScores(New List(Of Integer) From { + 20, + 10, + 30 + }) + Assert.Equal(New List(Of Integer) From { + 30, + 20, + 10 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereIsATie() + Dim sut = New HighScores(New List(Of Integer) From { + 40, + 20, + 40, + 30 + }) + Assert.Equal(New List(Of Integer) From { + 40, + 40, + 30 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereAreLessThan3() + Dim sut = New HighScores(New List(Of Integer) From { + 30, + 70 + }) + Assert.Equal(New List(Of Integer) From { + 70, + 30 + }, sut.PersonalTopThree()) + End Sub + + Public Sub PersonalTopWhenThereIsOnlyOne() + Dim sut = New HighScores(New List(Of Integer) From { + 40 + }) + Assert.Equal(New List(Of Integer) From { + 40 + }, sut.PersonalTopThree()) + End Sub +End Class \ No newline at end of file From 0b43c63599b27b30be06c61b57d754a5ac0e7994 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:06:16 +0800 Subject: [PATCH 06/12] back again again --- .../high-scores/.docs/instructions.md | 5 +++ .../practice/high-scores/.meta/Example.vb | 30 ++++++++++++++ .../practice/high-scores/.meta/config.json | 19 +++++++++ .../practice/high-scores/.meta/tests.toml | 40 +++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 exercises/practice/high-scores/.docs/instructions.md create mode 100644 exercises/practice/high-scores/.meta/Example.vb create mode 100644 exercises/practice/high-scores/.meta/config.json create mode 100644 exercises/practice/high-scores/.meta/tests.toml diff --git a/exercises/practice/high-scores/.docs/instructions.md b/exercises/practice/high-scores/.docs/instructions.md new file mode 100644 index 00000000..1f8154d5 --- /dev/null +++ b/exercises/practice/high-scores/.docs/instructions.md @@ -0,0 +1,5 @@ +# Instructions + +Manage a game player's High Score list. + +Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. diff --git a/exercises/practice/high-scores/.meta/Example.vb b/exercises/practice/high-scores/.meta/Example.vb new file mode 100644 index 00000000..43763f5c --- /dev/null +++ b/exercises/practice/high-scores/.meta/Example.vb @@ -0,0 +1,30 @@ +Imports System +Imports System.Collections.Generic +Imports System.Linq + +Public Class HighScores + Private scoresField = New List(Of Integer) + + Public Sub New(ByVal list As List(Of Integer)) + scoresField = list + End Sub + + Public Function Scores() As List(Of Integer) + Return scoresField + End Function + + Public Function Latest() As Integer + Return Enumerable.Last(scoresField) + End Function + + Public Function PersonalBest() As Integer + Return Enumerable.Max(scoresField) + End Function + + Public Function PersonalTopThree() As List(Of Integer) + Return (From score + In scores + Order By -score + Select score).Take(3).ToList() + End Function +End Class diff --git a/exercises/practice/high-scores/.meta/config.json b/exercises/practice/high-scores/.meta/config.json new file mode 100644 index 00000000..d1d58c75 --- /dev/null +++ b/exercises/practice/high-scores/.meta/config.json @@ -0,0 +1,19 @@ +{ + "blurb": "Manage a player's High Score list", + "authors": [ + "axtens" + ], + "contributors": [], + "files": { + "solution": [ + "HighScores.vb" + ], + "test": [ + "HighScoresTests.vb" + ], + "example": [ + ".meta/Example.vb" + ] + }, + "source": "Tribute to the eighties' arcade game Frogger" + } \ No newline at end of file diff --git a/exercises/practice/high-scores/.meta/tests.toml b/exercises/practice/high-scores/.meta/tests.toml new file mode 100644 index 00000000..c81c2288 --- /dev/null +++ b/exercises/practice/high-scores/.meta/tests.toml @@ -0,0 +1,40 @@ +# 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. + +[1035eb93-2208-4c22-bab8-fef06769a73c] +description = "List of scores" + +[6aa5dbf5-78fa-4375-b22c-ffaa989732d2] +description = "Latest score" + +[b661a2e1-aebf-4f50-9139-0fb817dd12c6] +description = "Personal best" + +[3d996a97-c81c-4642-9afc-80b80dc14015] +description = "Top 3 scores -> Personal top three from a list of scores" + +[1084ecb5-3eb4-46fe-a816-e40331a4e83a] +description = "Top 3 scores -> Personal top highest to lowest" + +[e6465b6b-5a11-4936-bfe3-35241c4f4f16] +description = "Top 3 scores -> Personal top when there is a tie" + +[f73b02af-c8fd-41c9-91b9-c86eaa86bce2] +description = "Top 3 scores -> Personal top when there are less than 3" + +[16608eae-f60f-4a88-800e-aabce5df2865] +description = "Top 3 scores -> Personal top when there is only one" + +[2df075f9-fec9-4756-8f40-98c52a11504f] +description = "Top 3 scores -> Latest score after personal top scores" + +[809c4058-7eb1-4206-b01e-79238b9b71bc] +description = "Top 3 scores -> Scores after personal top scores" From 310c072bae8d2855d2dfb08b9e7c4a43f3c255c6 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:20:02 +0800 Subject: [PATCH 07/12] fixed? --- config.json | 21 -------------------- exercises/practice/high-scores/HighScores.vb | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/config.json b/config.json index 0472f446..2b8140a2 100644 --- a/config.json +++ b/config.json @@ -288,27 +288,6 @@ "difficulty": 1, "topics": [ "lists" -]},{ - "slug": "matching-brackets", - "name": "Matching Brackets", - "uuid": "cf73cd5a-a63a-442d-8af6-fe379e4e1b2f", - "practices": [], - "prerequisites": [], - "difficulty": 5, - "topics": [ - "parsing", - "strings" - ] - },{ - "slug": "perfect-numbers", - "name": "Perfect Numbers", - "uuid": "2ca6be4d-3a3f-4b3c-9059-420c684394df", - "practices": [], - "prerequisites": [], - "difficulty": 3, - "topics": [ - "integers", - "math" ] } ] diff --git a/exercises/practice/high-scores/HighScores.vb b/exercises/practice/high-scores/HighScores.vb index 5bb4a0d4..f8cdb71a 100644 --- a/exercises/practice/high-scores/HighScores.vb +++ b/exercises/practice/high-scores/HighScores.vb @@ -1,4 +1,4 @@ -Imports System +Imports System Imports System.Linq Public Class HighScores From 8863eb8c4baeac5a8bda3521aaf8874ffd9a45c6 Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:21:45 +0800 Subject: [PATCH 08/12] fixing --- config.json | 1 - 1 file changed, 1 deletion(-) diff --git a/config.json b/config.json index 2b8140a2..17a2e9ae 100644 --- a/config.json +++ b/config.json @@ -197,7 +197,6 @@ ] }, { - "slug": "clock", "slug": "all-your-base", "name": "All Your Base", "uuid": "016ea49c-036b-44f7-909b-4c38aa62d636", From 8fe37835a16081f1142d9e7cb021a02cca0b670c Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Sat, 10 Jul 2021 22:28:55 +0800 Subject: [PATCH 09/12] Delete exercises/high-scores directory This directory is also in the exercises/practice tree. It can be safely deleted. --- exercises/high-scores/.docs/instructions.md | 5 - exercises/high-scores/.meta/Example.vb | 30 ------ exercises/high-scores/.meta/config.json | 19 ---- exercises/high-scores/HighScores.vb | 20 ---- exercises/high-scores/HighScores.vbproj | 17 --- exercises/high-scores/HighScoresTests.vb | 108 -------------------- 6 files changed, 199 deletions(-) delete mode 100644 exercises/high-scores/.docs/instructions.md delete mode 100644 exercises/high-scores/.meta/Example.vb delete mode 100644 exercises/high-scores/.meta/config.json delete mode 100644 exercises/high-scores/HighScores.vb delete mode 100644 exercises/high-scores/HighScores.vbproj delete mode 100644 exercises/high-scores/HighScoresTests.vb diff --git a/exercises/high-scores/.docs/instructions.md b/exercises/high-scores/.docs/instructions.md deleted file mode 100644 index 1f8154d5..00000000 --- a/exercises/high-scores/.docs/instructions.md +++ /dev/null @@ -1,5 +0,0 @@ -# Instructions - -Manage a game player's High Score list. - -Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. diff --git a/exercises/high-scores/.meta/Example.vb b/exercises/high-scores/.meta/Example.vb deleted file mode 100644 index 43763f5c..00000000 --- a/exercises/high-scores/.meta/Example.vb +++ /dev/null @@ -1,30 +0,0 @@ -Imports System -Imports System.Collections.Generic -Imports System.Linq - -Public Class HighScores - Private scoresField = New List(Of Integer) - - Public Sub New(ByVal list As List(Of Integer)) - scoresField = list - End Sub - - Public Function Scores() As List(Of Integer) - Return scoresField - End Function - - Public Function Latest() As Integer - Return Enumerable.Last(scoresField) - End Function - - Public Function PersonalBest() As Integer - Return Enumerable.Max(scoresField) - End Function - - Public Function PersonalTopThree() As List(Of Integer) - Return (From score - In scores - Order By -score - Select score).Take(3).ToList() - End Function -End Class diff --git a/exercises/high-scores/.meta/config.json b/exercises/high-scores/.meta/config.json deleted file mode 100644 index d1d58c75..00000000 --- a/exercises/high-scores/.meta/config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "blurb": "Manage a player's High Score list", - "authors": [ - "axtens" - ], - "contributors": [], - "files": { - "solution": [ - "HighScores.vb" - ], - "test": [ - "HighScoresTests.vb" - ], - "example": [ - ".meta/Example.vb" - ] - }, - "source": "Tribute to the eighties' arcade game Frogger" - } \ No newline at end of file diff --git a/exercises/high-scores/HighScores.vb b/exercises/high-scores/HighScores.vb deleted file mode 100644 index 5bb4a0d4..00000000 --- a/exercises/high-scores/HighScores.vb +++ /dev/null @@ -1,20 +0,0 @@ -Imports System -Imports System.Linq - -Public Class HighScores - Public Function Scores() As List(Of Integer) - Throw New NotImplementedException("You need to implement this function") - End Function - - Public Function Latest() As Integer - Throw New NotImplementedException("You need to implement this function") - End Function.. - - Public Function PersonalBest() As Integer - Throw New NotImplementedException("You need to implement this function") - End Function - - Public Function PersonalTopThree() As List(Of Integer) - Throw New NotImplementedException("You need to implement this function") - End Function -End Class diff --git a/exercises/high-scores/HighScores.vbproj b/exercises/high-scores/HighScores.vbproj deleted file mode 100644 index 3529b968..00000000 --- a/exercises/high-scores/HighScores.vbproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - diff --git a/exercises/high-scores/HighScoresTests.vb b/exercises/high-scores/HighScoresTests.vb deleted file mode 100644 index a98cc270..00000000 --- a/exercises/high-scores/HighScoresTests.vb +++ /dev/null @@ -1,108 +0,0 @@ -Imports System.Collections.Generic -Imports Xunit -Public Class HighScoresTest - - Public Sub ListOfScores() - Dim sut = New HighScores(New List(Of Integer) From { - 30, - 50, - 20, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 30, - 50, - 20, - 70 - }, sut.Scores()) - End Sub - - Public Sub LatestScore() - Dim sut = New HighScores(New List(Of Integer) From { - 100, - 0, - 90, - 30 - }) - Assert.Equal(30, sut.Latest()) - End Sub - - Public Sub PersonalBest() - Dim sut = New HighScores(New List(Of Integer) From { - 40, - 100, - 70 - }) - Assert.Equal(100, sut.PersonalBest()) - End Sub - - Public Sub PersonalTopThreeFromAListOfScores() - Dim sut = New HighScores(New List(Of Integer) From { - 10, - 30, - 90, - 30, - 100, - 20, - 10, - 0, - 30, - 40, - 40, - 70, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 100, - 90, - 70 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopHighestToLowest() - Dim sut = New HighScores(New List(Of Integer) From { - 20, - 10, - 30 - }) - Assert.Equal(New List(Of Integer) From { - 30, - 20, - 10 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereIsATie() - Dim sut = New HighScores(New List(Of Integer) From { - 40, - 20, - 40, - 30 - }) - Assert.Equal(New List(Of Integer) From { - 40, - 40, - 30 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereAreLessThan3() - Dim sut = New HighScores(New List(Of Integer) From { - 30, - 70 - }) - Assert.Equal(New List(Of Integer) From { - 70, - 30 - }, sut.PersonalTopThree()) - End Sub - - Public Sub PersonalTopWhenThereIsOnlyOne() - Dim sut = New HighScores(New List(Of Integer) From { - 40 - }) - Assert.Equal(New List(Of Integer) From { - 40 - }, sut.PersonalTopThree()) - End Sub -End Class \ No newline at end of file From 6f5e382e4beaafbd34dadf0d0649c2c9632fa80e Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Mon, 30 Aug 2021 17:05:25 +0800 Subject: [PATCH 10/12] Update config.json Made the language active --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 7d651bef..d74b3fb8 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "language": "VB.NET", "slug": "vbnet", - "active": false, + "active": true, "status": { "concept_exercises": false, "test_runner": false, From 5213bc094c3c54cc8c2fbfbb500838b6fff9a2fd Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Mon, 15 Jan 2024 14:12:28 +0800 Subject: [PATCH 11/12] leap --- exercises/practice/leap/.docs/instructions.md | 21 +------------------ exercises/practice/leap/.meta/config.json | 2 +- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md index a83826b2..b14f8565 100644 --- a/exercises/practice/leap/.docs/instructions.md +++ b/exercises/practice/leap/.docs/instructions.md @@ -1,22 +1,3 @@ # Instructions -Given a year, report if it is a leap year. - -The tricky thing here is that a leap year in the Gregorian calendar occurs: - -```text -on every year that is evenly divisible by 4 - except every year that is evenly divisible by 100 - unless the year is also evenly divisible by 400 -``` - -For example, 1997 is not a leap year, but 1996 is. -1900 is not a leap year, but 2000 is. - -## Notes - -Though our exercise adopts some very simple rules, there is more to learn! - -For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video]. - -[video]: https://www.youtube.com/watch?v=xX96xng7sAE +Your task is to determine whether a given year is a leap year. diff --git a/exercises/practice/leap/.meta/config.json b/exercises/practice/leap/.meta/config.json index 033fb3cd..cddc2b11 100644 --- a/exercises/practice/leap/.meta/config.json +++ b/exercises/practice/leap/.meta/config.json @@ -19,7 +19,7 @@ "Leap.vbproj" ] }, - "blurb": "Given a year, report if it is a leap year.", + "blurb": "Determine whether a given year is a leap year.", "source": "CodeRanch Cattle Drive, Assignment 3", "source_url": "https://coderanch.com/t/718816/Leap" } From d43030a9a8270df068de8b668995e524e383fd0b Mon Sep 17 00:00:00 2001 From: Bruce Axtens Date: Mon, 15 Jan 2024 14:13:41 +0800 Subject: [PATCH 12/12] leap update --- exercises/practice/leap/.docs/introduction.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 exercises/practice/leap/.docs/introduction.md diff --git a/exercises/practice/leap/.docs/introduction.md b/exercises/practice/leap/.docs/introduction.md new file mode 100644 index 00000000..1cb8b14c --- /dev/null +++ b/exercises/practice/leap/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +A leap year (in the Gregorian calendar) occurs: + +- In every year that is evenly divisible by 4 +- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. + +Some examples: + +- 1997 was not a leap year as it's not divisible by 4. +- 1900 was not a leap year as it's not divisible by 400 +- 2000 was a leap year! + +~~~~exercism/note +For a delightful, four minute explanation of the whole phenomenon of leap years, check out [this youtube video](https://www.youtube.com/watch?v=xX96xng7sAE). +~~~~