Skip to content

Simple cipher#360

Merged
keiravillekode merged 8 commits intoexercism:mainfrom
Narkunan:simple-cipher
Apr 12, 2026
Merged

Simple cipher#360
keiravillekode merged 8 commits intoexercism:mainfrom
Narkunan:simple-cipher

Conversation

@Narkunan
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link%5D(#359 ) to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions
Copy link
Copy Markdown
Contributor

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/cross-track-maintainers)

@keiravillekode
Copy link
Copy Markdown
Contributor

The tests are all good.

The tests in source/simple_cipher.d expect the class name to be VigenereCipher. The last test constructs a VigenereCipher without supplying a key, to test random key generation.

The solution currently in source/simple_cipher.d passes all the tests. Bu the solution currently in example/simple_cipher.d does not: a different class name is used, and the constructor does not allow the key to be omitted.

Let's delete the current contents of example/simple_cipher.d, and instead use the current first 75 lines of source/simple_cipher.d as our new example/simple_cipher.d

In source/simple_cipher.d we can have

import ...

class VigenereCipher {
    this(string key = "") {
        // implement this function
    }

    string encode(string plaintext) {
        // implement this function
    }

    string decode(string ciphertext) {
        // implement this function
    }

    string getKey() {
        // implement this function
    }
}

unittest {
...

We can check that the example solution passes by running

$ bin/test-exercise  exercises/practice/simple-cipher

@keiravillekode
Copy link
Copy Markdown
Contributor

The robot-simulator exercise has a similar structure:

example/robot_simulator.d has a working solution.

source/robot_simulator.d has

import ...

class RobotSimulator
{
    this(int x, int y, string direction)
    {
        // implement this function
    }

    void move(string commands)
    {
        // implement this function
    }
}

unittest
...

Comment thread config.json Outdated
@keiravillekode
Copy link
Copy Markdown
Contributor

If you are interested in adding another exercise after this, you might find the bin/add-practice-exercise script helpful.

For example,

$ bin/add-practice-exercise -a Narkunan -d 6 rail-fence-cipher

will update the config.json files for you, and copy the instructions.

@keiravillekode keiravillekode merged commit c275c3c into exercism:main Apr 12, 2026
5 checks passed
@keiravillekode
Copy link
Copy Markdown
Contributor

Many thanks for contributing this exercise.

I'm not sure why you removed generateKey() and the last unit test.

@Narkunan
Copy link
Copy Markdown
Contributor Author

Many thanks for contributing this exercise.

I'm not sure why you removed generateKey() and the last unit test.

Thanks for accepting my PR

I thought they are out of scope because mostly we will concern about encryption and decryption That's why I removed

@keiravillekode
Copy link
Copy Markdown
Contributor

D contributors has a new entry. 🚀

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