-
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
Andre Susantin
committed
Jun 22, 2024
1 parent
3efb9c7
commit 1e03fb6
Showing
22 changed files
with
704 additions
and
68 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,27 @@ | ||
{ | ||
"authors": [ | ||
"ErikSchierboom" | ||
], | ||
"contributors": [ | ||
"j2jensen", | ||
"robkeim", | ||
"wolf99" | ||
], | ||
"files": { | ||
"solution": [ | ||
"CircularBuffer.cs" | ||
], | ||
"test": [ | ||
"CircularBufferTests.cs" | ||
], | ||
"example": [ | ||
".meta/Example.cs" | ||
], | ||
"invalidator": [ | ||
"CircularBuffer.csproj" | ||
] | ||
}, | ||
"blurb": "A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.", | ||
"source": "Wikipedia", | ||
"source_url": "https://en.wikipedia.org/wiki/Circular_buffer" | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"track":"csharp","exercise":"circular-buffer","id":"63710780b34a48898f11e31386975e9e","url":"https://exercism.io/my/solutions/63710780b34a48898f11e31386975e9e","handle":"dynamo-patch","is_requester":true,"auto_approve":false} | ||
{"track":"csharp","exercise":"circular-buffer","id":"63710780b34a48898f11e31386975e9e","url":"https://exercism.org/tracks/csharp/exercises/circular-buffer","handle":"dynamo-patch","is_requester":true,"auto_approve":false} |
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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.0</TargetFramework> | ||
<TargetFramework>net7.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="Example.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" /> | ||
<PackageReference Include="Exercism.Tests" Version="0.1.0-beta1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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,39 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
You can run the tests by opening a command prompt in the exercise's directory, and then running the [`dotnet test` command](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test) | ||
Alternatively, most IDE's have built-in support for running tests, including [Visual Studio](https://docs.microsoft.com/en-us/visualstudio/test/run-unit-tests-with-test-explorer), [Rider](https://www.jetbrains.com/help/rider/Unit_Testing_in_Solution.html) and [Visual Studio code](https://github.com/OmniSharp/omnisharp-vscode/wiki/How-to-run-and-debug-unit-tests). | ||
See the [tests page](https://exercism.org/docs/tracks/csharp/tests) for more information. | ||
|
||
## Skipped tests | ||
|
||
Initially, only the first test will be enabled. | ||
This is to encourage you to solve the exercise one step at a time. | ||
Once you get the first test passing, remove the `Skip` property from the next test and work on getting that test passing. | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit CircularBuffer.cs` command. | ||
This command will upload your solution to the Exercism website and print the solution page's URL. | ||
|
||
It's possible to submit an incomplete solution which allows you to: | ||
|
||
- See how others have completed the exercise | ||
- Request help from a mentor | ||
|
||
## Need to get help? | ||
|
||
If you'd like help solving the exercise, check the following pages: | ||
|
||
- The [C# track's documentation](https://exercism.org/docs/tracks/csharp) | ||
- The [C# track's programming category on the forum](https://forum.exercism.org/c/programming/csharp) | ||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) | ||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) | ||
|
||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. | ||
|
||
To get help if you're having trouble, you can use one of the following resources: | ||
|
||
- [/r/csharp](https://www.reddit.com/r/csharp) is the C# subreddit. | ||
- [StackOverflow](http://stackoverflow.com/questions/tagged/c%23) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. |
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 |
---|---|---|
@@ -1,70 +1,63 @@ | ||
# Circular Buffer | ||
|
||
A circular buffer, cyclic buffer or ring buffer is a data structure that | ||
uses a single, fixed-size buffer as if it were connected end-to-end. | ||
Welcome to Circular Buffer on Exercism's C# Track. | ||
If you need help running the tests or submitting your code, check out `HELP.md`. | ||
|
||
A circular buffer first starts empty and of some predefined length. For | ||
example, this is a 7-element buffer: | ||
## Instructions | ||
|
||
[ ][ ][ ][ ][ ][ ][ ] | ||
A circular buffer, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. | ||
|
||
Assume that a 1 is written into the middle of the buffer (exact starting | ||
location does not matter in a circular buffer): | ||
A circular buffer first starts empty and of some predefined length. | ||
For example, this is a 7-element buffer: | ||
<!-- prettier-ignore --> | ||
[ ][ ][ ][ ][ ][ ][ ] | ||
|
||
Assume that a 1 is written into the middle of the buffer (exact starting location does not matter in a circular buffer): | ||
<!-- prettier-ignore --> | ||
[ ][ ][ ][1][ ][ ][ ] | ||
|
||
Then assume that two more elements are added — 2 & 3 — which get | ||
appended after the 1: | ||
|
||
Then assume that two more elements are added — 2 & 3 — which get appended after the 1: | ||
<!-- prettier-ignore --> | ||
[ ][ ][ ][1][2][3][ ] | ||
|
||
If two elements are then removed from the buffer, the oldest values | ||
inside the buffer are removed. The two elements removed, in this case, | ||
are 1 & 2, leaving the buffer with just a 3: | ||
|
||
If two elements are then removed from the buffer, the oldest values inside the buffer are removed. | ||
The two elements removed, in this case, are 1 & 2, leaving the buffer with just a 3: | ||
<!-- prettier-ignore --> | ||
[ ][ ][ ][ ][ ][3][ ] | ||
|
||
If the buffer has 7 elements then it is completely full: | ||
<!-- prettier-ignore --> | ||
[5][6][7][8][9][3][4] | ||
|
||
[6][7][8][9][3][4][5] | ||
|
||
When the buffer is full an error will be raised, alerting the client | ||
that further writes are blocked until a slot becomes free. | ||
|
||
When the buffer is full, the client can opt to overwrite the oldest | ||
data with a forced write. In this case, two more elements — A & B — | ||
are added and they overwrite the 3 & 4: | ||
When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free. | ||
|
||
[6][7][8][9][A][B][5] | ||
When the buffer is full, the client can opt to overwrite the oldest data with a forced write. | ||
In this case, two more elements — A & B — are added and they overwrite the 3 & 4: | ||
<!-- prettier-ignore --> | ||
[5][6][7][8][9][A][B] | ||
|
||
3 & 4 have been replaced by A & B making 5 now the oldest data in the | ||
buffer. Finally, if two elements are removed then what would be | ||
returned is 5 & 6 yielding the buffer: | ||
3 & 4 have been replaced by A & B making 5 now the oldest data in the buffer. | ||
Finally, if two elements are removed then what would be returned is 5 & 6 yielding the buffer: | ||
<!-- prettier-ignore --> | ||
[ ][ ][7][8][9][A][B] | ||
|
||
[ ][7][8][9][A][B][ ] | ||
Because there is space available, if the client again uses overwrite to store C & D then the space where 5 & 6 were stored previously will be used not the location of 7 & 8. | ||
7 is still the oldest element and the buffer is once again full. | ||
<!-- prettier-ignore --> | ||
[C][D][7][8][9][A][B] | ||
|
||
Because there is space available, if the client again uses overwrite | ||
to store C & D then the space where 5 & 6 were stored previously will | ||
be used not the location of 7 & 8. 7 is still the oldest element and | ||
the buffer is once again full. | ||
|
||
[D][7][8][9][A][B][C] | ||
|
||
## Running the tests | ||
|
||
To run the tests, run the command `dotnet test` from within the exercise directory. | ||
## Source | ||
|
||
Initially, only the first test will be enabled. This is to encourage you to solve the exercise one step at a time. | ||
Once you get the first test passing, remove the `Skip` property from the next test and work on getting that test passing. | ||
Once none of the tests are skipped and they are all passing, you can submit your solution | ||
using `exercism submit CircularBuffer.cs` | ||
### Created by | ||
|
||
## Further information | ||
- @ErikSchierboom | ||
|
||
For more detailed information about the C# track, including how to get help if | ||
you're having trouble, please visit the exercism.io [C# language page](http://exercism.io/languages/csharp/resources). | ||
### Contributed to by | ||
|
||
## Source | ||
- @j2jensen | ||
- @robkeim | ||
- @wolf99 | ||
|
||
Wikipedia [http://en.wikipedia.org/wiki/Circular_buffer](http://en.wikipedia.org/wiki/Circular_buffer) | ||
### Based on | ||
|
||
Wikipedia - https://en.wikipedia.org/wiki/Circular_buffer |
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,20 @@ | ||
{ | ||
"blurb": "Learn about strings by processing logs.", | ||
"contributors": [ | ||
"yzAlvin" | ||
], | ||
"authors": [ | ||
"ErikSchierboom" | ||
], | ||
"files": { | ||
"solution": [ | ||
"LogLevels.cs" | ||
], | ||
"test": [ | ||
"LogLevelsTests.cs" | ||
], | ||
"exemplar": [ | ||
".meta/Exemplar.cs" | ||
] | ||
} | ||
} |
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 @@ | ||
{"track":"csharp","exercise":"log-levels","id":"589436fa563d43d2ac9f77e8e29d0f0e","url":"https://exercism.org/tracks/csharp/exercises/log-levels","handle":"dynamo-patch","is_requester":true,"auto_approve":false} |
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,39 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
You can run the tests by opening a command prompt in the exercise's directory, and then running the [`dotnet test` command](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test) | ||
Alternatively, most IDE's have built-in support for running tests, including [Visual Studio](https://docs.microsoft.com/en-us/visualstudio/test/run-unit-tests-with-test-explorer), [Rider](https://www.jetbrains.com/help/rider/Unit_Testing_in_Solution.html) and [Visual Studio code](https://github.com/OmniSharp/omnisharp-vscode/wiki/How-to-run-and-debug-unit-tests). | ||
See the [tests page](https://exercism.io/tracks/csharp/tests) for more information. | ||
|
||
## Skipped tests | ||
|
||
Initially, only the first test will be enabled. | ||
This is to encourage you to solve the exercise one step at a time. | ||
Once you get the first test passing, remove the `Skip` property from the next test and work on getting that test passing. | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit LogLevels.cs` command. | ||
This command will upload your solution to the Exercism website and print the solution page's URL. | ||
|
||
It's possible to submit an incomplete solution which allows you to: | ||
|
||
- See how others have completed the exercise | ||
- Request help from a mentor | ||
|
||
## Need to get help? | ||
|
||
If you'd like help solving the exercise, check the following pages: | ||
|
||
- The [C# track's documentation](https://exercism.org/docs/tracks/csharp) | ||
- [Exercism's support channel on gitter](https://gitter.im/exercism/support) | ||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) | ||
|
||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. | ||
|
||
To get help if you're having trouble, you can use one of the following resources: | ||
|
||
- [Gitter](https://gitter.im/exercism/xcsharp) is Exercism C# track's Gitter room; go here to get support and ask questions related to the C# track. | ||
- [/r/csharp](https://www.reddit.com/r/csharp) is the C# subreddit. | ||
- [StackOverflow](http://stackoverflow.com/questions/tagged/c%23) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. |
Oops, something went wrong.