Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend coin flip syntax to support multiple flips #217

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

lunakv
Copy link
Contributor

@lunakv lunakv commented Nov 18, 2023

Just as a small nice-to-have, sometimes you want to flip more than one coin. This PR extends the coin command to support an optional numeric parameter.

Example queries:

<vaasa> !coin
<vaasatog> Heads.
<vaasa> !coin 1
<vaasatog> Heads.
<vaasa> !coin 3
<vaasatog> Tails, Heads, Heads.
<vaasa> !coin 15
<vaasatog> 15 coins: TTHHTHTTTTTTTTT.
<vaasa> !coin 1000
<vaasatog> malformed coin toss (max count is 50)
<vaasa> !coin 0
<vaasatog> malformed coin toss (min count is 1)

@lunakv lunakv force-pushed the multiple-coin-flips branch 2 times, most recently from 9b38630 to 5e8fa62 Compare November 18, 2023 12:36
@@ -8,7 +8,7 @@ import (

func TestFlipCoin(t *testing.T) {
for i := 1; i < 10; i++ {
result := flipCoin()
result := flipCoin("coin")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write some tests for the new functionality?
Many coins, too many coins, negative number of coins etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some tests.

@Fryyyyy Fryyyyy merged commit e0ebd96 into Fryyyyy:master Nov 21, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants