-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[New exercise]: two-fer #8
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4efdf70
Add two-fer
meatball133 9af10d3
Add author
meatball133 ec661d7
Fix formatting
meatball133 49eb9a8
Fixed test file
meatball133 c4c4c92
Merge branch 'main' into add-two-fer
meatball133 18d142b
Change from spaces to tab
meatball133 40111e1
Fix exemplar file
meatball133 8559a39
Update test name
meatball133 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,25 @@ | ||
# Instructions | ||
|
||
Your task is to determine what you will say as you give away the extra cookie. | ||
|
||
If your friend likes cookies, and is named Do-yun, then you will say: | ||
|
||
```text | ||
One for Do-yun, one for me. | ||
``` | ||
|
||
If your friend doesn't like cookies, you give the cookie to the next person in line at the bakery. | ||
Since you don't know their name, you will say _you_ instead. | ||
|
||
```text | ||
One for you, one for me. | ||
``` | ||
|
||
Here are some examples: | ||
|
||
| Name | Dialogue | | ||
| :----- | :-------------------------- | | ||
| Alice | One for Alice, one for me. | | ||
| Bohdan | One for Bohdan, one for me. | | ||
| | One for you, one for me. | | ||
| Zaphod | One for Zaphod, one for me. | |
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,8 @@ | ||
# Introduction | ||
|
||
In some English accents, when you say "two for" quickly, it sounds like "two fer". | ||
Two-for-one is a way of saying that if you buy one, you also get one for free. | ||
So the phrase "two-fer" often implies a two-for-one offer. | ||
|
||
Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!"). | ||
You go for the offer and (very generously) decide to give the extra cookie to a friend. |
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,16 @@ | ||
{ | ||
"authors": ["meatball133"], | ||
"files": { | ||
"solution": [ | ||
"two_fer.gd" | ||
], | ||
"test": [ | ||
"two_fer_test.gd" | ||
], | ||
"example": [ | ||
".meta/example.gd" | ||
] | ||
}, | ||
"blurb": "Create a sentence of the form \"One for X, one for me.\".", | ||
"source_url": "https://github.com/exercism/problem-specifications/issues/757" | ||
} |
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,2 @@ | ||
func two_fer(name = "you"): | ||
return "One for %s, one for me." % name |
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,19 @@ | ||
# 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. | ||
|
||
[1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce] | ||
description = "no name given" | ||
|
||
[b4c6dbb8-b4fb-42c2-bafd-10785abe7709] | ||
description = "a name given" | ||
|
||
[3549048d-1a6e-4653-9a79-b0bda163e8d5] | ||
description = "another name given" |
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,2 @@ | ||
func two_fer(): | ||
pass |
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,8 @@ | ||
func no_name_given(solution_script): | ||
return [solution_script.two_fer(), "One for you, one for me."] | ||
|
||
func a_name_given(solution_script): | ||
return [solution_script.two_fer("Alice"), "One for Alice, one for me."] | ||
|
||
func another_name_given(solution_script): | ||
return [solution_script.two_fer("Bob"), "One for Bob, one for me."] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test methods need to start with
test_
for the new test runner to pick them up ;)It is also a standard in GDScript to have 2 empty lines between methods.
Other than this, I think the solution and tests look good 👍