Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions config/exercise_readme.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
{{- with .Hints }}
{{ . }}
{{ end }}
{{- with .TrackInsert }}
{{ . }}
{{ end }}
{{- with .Spec.Credits -}}

## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests:

% ./phpunit.phar {{ .Spec.Slug }}/{{ .Spec.Slug }}_test.php

[PHPUnit]: http://phpunit.de

{{ with .Spec.Credits }}
## Source

{{ . }}
Expand Down
13 changes: 0 additions & 13 deletions docs/EXERCISE_README_INSERT.md

This file was deleted.

15 changes: 9 additions & 6 deletions exercises/accumulate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ Keep your hands off that collect/map/fmap/whatchamacallit functionality
provided by your standard library!
Solve this one yourself using other basic tools instead.

Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent,
as this is idiomatic Lisp, not a library function.

## Making the Test Suite Pass
## Running the tests

1. Get [PHPUnit].
1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar accumulate/accumulate_test.php

[PHPUnit]: http://phpunit.de

Expand Down
13 changes: 9 additions & 4 deletions exercises/acronym/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ Help generate some jargon by writing a program that converts a long name
like Portable Network Graphics to its acronym (PNG).


## Making the Test Suite Pass
## Running the tests

1. Get [PHPUnit].
1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar acronym/acronym_test.php

[PHPUnit]: http://phpunit.de

Expand Down
46 changes: 35 additions & 11 deletions exercises/all-your-base/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# All Your Base

Convert a number, represented as a sequence of digits in one base, to any other base.

Implement general base conversion. Given a number in base **a**,
Expand All @@ -8,24 +10,46 @@ represented as a sequence of digits, convert it to base **b**.
- Try to implement the conversion yourself.
Do not use something else to perform the conversion for you.

## About [Positional Notation](https://en.wikipedia.org/wiki/Positional_notation)
## About [Positional Notation](https://en.wikipedia.org/wiki/Positional_notation)

In positional notation, a number in base **b** can be understood as a linear
combination of powers of **b**.

The number 42, *in base 10*, means:

(4 * 10^1) + (2 * 10^0)

The number 101010, *in base 2*, means:

(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)

The number 1120, *in base 3*, means:

(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)

I think you got the idea!

*Yes. Those three numbers above are exactly the same. Congratulations!*


In positional notation, a number in base **b** can be understood as a linear
combination of powers of **b**.
## Running the tests

The number 42, *in base 10*, means:
1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

(4 * 10^1) + (2 * 10^0)
% exercism debug | grep Workspace

The number 101010, *in base 2*, means:
1. Get [PHPUnit] if you don't have it already.

(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)
% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

The number 1120, *in base 3*, means:
2. Execute the tests:

(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)
% ./phpunit.phar all-your-base/all-your-base_test.php

I think you got the idea!
[PHPUnit]: http://phpunit.de

*Yes. Those three numbers above are exactly the same. Congratulations!*

## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
13 changes: 9 additions & 4 deletions exercises/allergies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ ignore those components of the score. For example, if the allergy
score is 257, your program should only report the eggs (1) allergy.


## Making the Test Suite Pass
## Running the tests

1. Get [PHPUnit].
1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar allergies/allergies_test.php

[PHPUnit]: http://phpunit.de

Expand Down
14 changes: 10 additions & 4 deletions exercises/anagram/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ Given `"listen"` and a list of candidates like `"enlists" "google"
"inlets" "banana"` the program should return a list containing
`"inlets"`.

## Making the Test Suite Pass

1. Get [PHPUnit].
## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar anagram/anagram_test.php

[PHPUnit]: http://phpunit.de

Expand Down
17 changes: 12 additions & 5 deletions exercises/atbash-cipher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ letter, the second with the second-last, and so on.

An Atbash cipher for the Latin alphabet would be as follows:

```plain
```text
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: zyxwvutsrqponmlkjihgfedcba
```
Expand All @@ -23,20 +23,27 @@ being 5 letters, and punctuation is excluded. This is to make it harder to guess
things based on word boundaries.

## Examples

- Encoding `test` gives `gvhg`
- Decoding `gvhg` gives `test`
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`

## Making the Test Suite Pass

1. Get [PHPUnit].
## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar atbash-cipher/atbash-cipher_test.php

[PHPUnit]: http://phpunit.de

Expand Down
18 changes: 12 additions & 6 deletions exercises/beer-song/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Beer Song

Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
Recite the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.

Note that not all verses are identical.

```plain
```text
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

Expand Down Expand Up @@ -320,16 +320,22 @@ are some additional things you could try:
Then please share your thoughts in a comment on the submission. Did this
experiment make the code better? Worse? Did you learn anything from it?

## Making the Test Suite Pass

1. Get [PHPUnit].
## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar beer-song/beer-song_test.php

[PHPUnit]: http://phpunit.de

Expand Down
14 changes: 10 additions & 4 deletions exercises/binary-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ A binary search halves the number of items to check with each iteration,
so locating an item (or determining its absence) takes logarithmic time.
A binary search is a dichotomic divide and conquer search algorithm.

## Making the Test Suite Pass

1. Get [PHPUnit].
## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar binary-search/binary-search_test.php

[PHPUnit]: http://phpunit.de

Expand Down
16 changes: 12 additions & 4 deletions exercises/binary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ string, your program should produce a decimal output. The
program should handle invalid inputs.

## Note

- Implement the conversion yourself.
Do not use something else to perform the conversion for you.

## About Binary (Base-2)

Decimal is a base-10 system.

A number 23 in base 10 notation can be understood
Expand All @@ -28,16 +30,22 @@ Binary is similar, but uses powers of 2 rather than powers of 10.

So: `101 => 1*2^2 + 0*2^1 + 1*2^0 => 1*4 + 0*2 + 1*1 => 4 + 1 => 5 base 10`.

## Making the Test Suite Pass

1. Get [PHPUnit].
## Running the tests

1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/php`.
To find the Exercism workspace run

% exercism debug | grep Workspace

1. Get [PHPUnit] if you don't have it already.

% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
% chmod +x phpunit.phar

2. Execute the tests for an assignment.
2. Execute the tests:

% phpunit.phar wordy/wordy_test.php
% ./phpunit.phar binary/binary_test.php

[PHPUnit]: http://phpunit.de

Expand Down
10 changes: 10 additions & 0 deletions exercises/bob/.meta/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Bob is a lackadaisical teenager. In conversation, his responses are very limited.

Bob answers 'Sure.' if you ask him a question.

He answers 'Whoa, chill out!' if you yell at him.

He says 'Fine. Be that way!' if you address him without actually saying
anything.

He answers 'Whatever.' to anything else.
Loading