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
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-319 of the linear memory are reserved for the input string.

Expand Down
6 changes: 4 additions & 2 deletions exercises/practice/bob/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-319 of the linear memory are reserved for the input string.

The input string can be modified in place if desired.
The input string can be modified in place if desired.
2 changes: 1 addition & 1 deletion exercises/practice/bob/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "Bob is a lackadaisical teenager. In conversation, his responses are very limited.",
"source": "Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial.",
"source_url": "https://pine.fm/LearnToProgram/?Chapter=06",
"source_url": "https://pine.fm/LearnToProgram/chap_06.html",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/book-store/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.",
"source": "Inspired by the harry potter kata from Cyber-Dojo.",
"source_url": "https://cyber-dojo.org",
"source_url": "https://cyber-dojo.org/creator/home",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions append

## Track specific instructions

The `read` returns a Go-style error handling type `(i32,i32)`
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions append

## Track specific instructions

If `n` is _not_ a positive integer, don't continue executing and return `-1` to indicate an error condition.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-319 of the linear memory are reserved for the input string.
4 changes: 3 additions & 1 deletion exercises/practice/diamond/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Diamond format
# Instructions append

## Track specific instructions

The diamond is represented as a string, with a newline character at the end of each row.
2 changes: 1 addition & 1 deletion exercises/practice/etl/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "Change the data format for scoring a game to more easily add other languages.",
"source": "Based on an exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu",
"source_url": "https://www.turing.edu/",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/grade-school/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-191 of the linear memory are reserved for the input string.

Expand Down
2 changes: 2 additions & 0 deletions exercises/practice/high-scores/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Instructions append

## Track specific instructions

You may assume that the high score list is never empty.

For the last task, if there are less than 3 scores, leave the remaining return values at zero.
2 changes: 2 additions & 0 deletions exercises/practice/house/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instruction append

## Track specific instructions

Each verse should end with a newline `\n`, with no additional delimiter.
2 changes: 1 addition & 1 deletion exercises/practice/kindergarten-garden/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu",
"source_url": "https://www.turing.edu/",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/luhn/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ If the sum is evenly divisible by 10, the original number is valid.

### Invalid Canadian SIN

The number to be checked is `066 123 468`.
The number to be checked is `066 123 478`.

We start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-319 of the linear memory are reserved for the input string.

The input string can be modified in place if desired.
The input string can be modified in place if desired.
4 changes: 3 additions & 1 deletion exercises/practice/micro-blog/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Reserved Memory
# Instructions append

## Track specific instructions

The buffer for the UTF-8 input string uses bytes 64-319 of linear memory.

Expand Down
7 changes: 5 additions & 2 deletions exercises/practice/minesweeper/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Instructions append

## Minefield format
## Track specific instructions

### Minefield format

The minefield is represented as a string, with a newline character at the end of each row.

An example would be `" \n * \n \n"`

## Reserved Memory
### Reserved Memory

The buffer for the input string uses bytes 64-319 of linear memory.

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/ocr-numbers/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-191 of the linear memory are reserved for the input string.

Expand Down
80 changes: 24 additions & 56 deletions exercises/practice/ocr-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,47 @@
# Instructions

Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled.
Optical Character Recognition or OCR is software that converts images of text into machine-readable text.
Given a grid of characters representing some digits, convert the grid to a string of digits.
If the grid has multiple rows of cells, the rows should be separated in the output with a `","`.

## Step One
- The grid is made of one of more lines of cells.
- Each line of the grid is made of one or more cells.
- Each cell is three columns wide and four rows high (3x4) and represents one digit.
- Digits are drawn using pipes (`"|"`), underscores (`"_"`), and spaces (`" "`).

To begin with, convert a simple binary font to a string containing 0 or 1.
## Edge cases

The binary font uses pipes and underscores, four rows high and three columns wide.
- If the input is not a valid size, your program should indicate there is an error.
- If the input is the correct size, but a cell is not recognizable, your program should output a `"?"` for that character.

```text
_ #
| | # zero.
|_| #
# the fourth row is always blank
```
## Examples

Is converted to "0"

```text
#
| # one.
| #
# (blank fourth row)
```

Is converted to "1"

If the input is the correct size, but not recognizable, your program should return '?'

If the input is the incorrect size, your program should return an error.

## Step Two

Update your program to recognize multi-character binary strings, replacing garbled numbers with ?

## Step Three

Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string.

```text
_
_|
|_

```

Is converted to "2"
The following input (without the comments) is converted to `"1234567890"`.

```text
_ _ _ _ _ _ _ _ #
| _| _||_||_ |_ ||_||_|| | # decimal numbers.
| _| _||_||_ |_ ||_||_|| | # Decimal numbers.
||_ _| | _||_| ||_| _||_| #
# fourth line is always blank
# The fourth line is always blank,
```

Is converted to "1234567890"

## Step Four
The following input is converted to `"123,456,789"`.

Update your program to handle multiple numbers, one per line.
When converting several lines, join the lines with commas.
<!-- prettier-ignore-start -->

```text
_ _
_ _
| _| _|
||_ _|

_ _
|_||_ |_
_ _
|_||_ |_
| _||_|

_ _ _
_ _ _
||_||_|
||_| _|

```

Is converted to "123,456,789".
<!-- prettier-ignore-end -->
6 changes: 6 additions & 0 deletions exercises/practice/ocr-numbers/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Introduction

Your best friend Marta recently landed their dream job working with a local history museum's collections.
Knowing of your interests in programming, they confide in you about an issue at work for an upcoming exhibit on computing history.
A local university's math department had donated several boxes of historical printouts, but given the poor condition of the documents, the decision has been made to digitize the text.
However, the university's old printer had some quirks in how text was represented, and your friend could use your help to extract the data successfully.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## Return values
# Instructions append

The functions are supposed to return the product and the offset and length of the factors array. The factors are just written as pairs of i32 into memory:
## Track specific instructions

The functions are supposed to return the product and the offset and length of the factors array.
The factors are just written as pairs of i32 into memory:

```
Return value:
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/phone-number/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "Clean up user-entered phone numbers so that they can be sent SMS messages.",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu",
"source_url": "https://www.turing.edu/",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/pig-latin/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Reserved Memory
# Instructions append

## Track specific instructions

Bytes 64-319 of the linear memory are reserved for the input string.

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/pig-latin/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"blurb": "Implement a program that translates from English to Pig Latin.",
"source": "The Pig Latin exercise at Test First Teaching by Ultrasaurus",
"source_url": "https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/",
"source_url": "https://github.com/ultrasaurus/test-first-teaching/tree/master/learn_ruby/pig_latin",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
Expand Down
47 changes: 20 additions & 27 deletions exercises/practice/protein-translation/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
# Instructions

Translate RNA sequences into proteins.
Your job is to translate RNA sequences into proteins.

RNA can be broken into three-nucleotide sequences called codons, and then translated to a protein like so:
RNA strands are made up of three-nucleotide sequences called **codons**.
Each codon translates to an **amino acid**.
When joined together, those amino acids make a protein.

RNA: `"AUGUUUUCU"` => translates to

Codons: `"AUG", "UUU", "UCU"`
=> which become a protein with the following sequence =>

Protein: `"Methionine", "Phenylalanine", "Serine"`

There are 64 codons which in turn correspond to 20 amino acids; however, all of the codon sequences and resulting amino acids are not important in this exercise.
If it works for one codon, the program should work for all of them.
However, feel free to expand the list in the test suite to include them all.

There are also three terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated.

All subsequent codons after are ignored, like this:

RNA: `"AUGUUUUCUUAAAUG"` =>

Codons: `"AUG", "UUU", "UCU", "UAA", "AUG"` =>

Protein: `"Methionine", "Phenylalanine", "Serine"`

Note the stop codon `"UAA"` terminates the translation and the final methionine is not translated into the protein sequence.

Below are the codons and resulting amino acids needed for the exercise.
In the real world, there are 64 codons, which in turn correspond to 20 amino acids.
However, for this exercise, you’ll only use a few of the possible 64.
They are listed below:

| Codon | Amino Acid |
| :----------------- | :------------ |
| ------------------ | ------------- |
| AUG | Methionine |
| UUU, UUC | Phenylalanine |
| UUA, UUG | Leucine |
Expand All @@ -40,6 +21,18 @@ Below are the codons and resulting amino acids needed for the exercise.
| UGG | Tryptophan |
| UAA, UAG, UGA | STOP |

For example, the RNA string “AUGUUUUCU” has three codons: “AUG”, “UUU” and “UCU”.
These map to Methionine, Phenylalanine, and Serine.

## “STOP” Codons

You’ll note from the table above that there are three **“STOP” codons**.
If you encounter any of these codons, ignore the rest of the sequence — the protein is complete.

For example, “AUGUUUUCUUAAAUG” contains a STOP codon (“UAA”).
Once we reach that point, we stop processing.
We therefore only consider the part before it (i.e. “AUGUUUUCU”), not any further codons after it (i.e. “AUG”).

Learn more about [protein translation on Wikipedia][protein-translation].

[protein-translation]: https://en.wikipedia.org/wiki/Translation_(biology)
11 changes: 8 additions & 3 deletions exercises/practice/queen-attack/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Instructions append

## Track specific instructions

A queen must be placed on a valid position on the board.
Two queens cannot share the same position.

The queens shown below are at their [default starting positions](https://en.wikipedia.org/wiki/Rules_of_chess#Initial_setup). That's the 1st rank (row 7) for the white queen and the 8th rank (row 0) for the black queen. Both queens start in the d file (column 3).
The queens shown below are at their [default starting positions](https://en.wikipedia.org/wiki/Rules_of_chess#Initial_setup).
That's the 1st rank (row 7) for the white queen and the 8th rank (row 0) for the black queen.
Both queens start in the d file (column 3).

```text
a b c d e f g h
Expand All @@ -18,9 +22,10 @@ The queens shown below are at their [default starting positions](https://en.wiki
a b c d e f g h
```

# Positions argument
## Positions argument

The function will receive only a single unsigned 32bit number as argument. Both rows and columns are encoded into it:
The function will receive only a single unsigned 32bit number as argument.
Both rows and columns are encoded into it:

- The chess notation files a..h become zero-indexed columns 0..7
- The chess notation ranks 8..1 become zero-indexed rows 0..7
Expand Down
Loading