exercism / mips

Exercism exercises in MIPS Assembly.
https://exercism.org/tracks/mips
MIT License
21 stars 29 forks source link

Add more exercises to MIPS track #13

Open mpriestman opened 8 years ago

mpriestman commented 8 years ago

Issue to just discuss possible problems that could be added to the MIPS track. Looking down the list of available ones from other languages (http://exercism.io/languages/mips/contribute), a lot seem just too hard for assembly (a lot involve string or data structure manipulation). However, I think there are still some that could make the transition to assembly. The following could be good candidates:

Could also try to come up with some new exercises just for the MIPS track that are more "assembly-like".

Any thoughts?

ozan commented 8 years ago

Hey there! These are great choices. I agree that many of the standard exercise problems involve a lot of branchy string manipulation work or require libraries for functionality like Georgian dates. After implementing these it may make sense to add new problems that suit lower level programming. For instance we could add some of the exercises from K&R C.

Regarding nucleotide count, your strategy would be fine, or the caller could just specify a memory location at which it expects the callee to write four ints. If we maxed each count out at 256 we could even cram it all into one register :)

On Tuesday, August 30, 2016, mpriestman notifications@github.com wrote:

Issue to just discuss possible problems that could be added to the MIPS track. Looking down the list of available ones from other languages ( http://exercism.io/languages/mips/contribute), a lot seem just too hard for assembly (a lot involve string or data structure manipulation). However, I think there are still some that could make the transition to assembly. The following could be good candidates:

  • difference-of-squares - seems pretty straightforward, single integer input, single integer output.
  • nucleotide-count - simple input, but needs to return 4 integer values. Could use hi and lo parts of v0 and v1?
  • atbash-cipher - single string input, fixed size string output.
  • luhn - could make for an interesting challenge, string input, boolean result.
  • pangram - pretty similar to the isogram problem.
  • binary-search - could be fun too.

Could also try to come up with some new exercises just for the MIPS track that are more "assembly-like".

Any thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/exercism/xmips/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG6z-Ldh956TKCwD--x-3TU79YuqKRMks5qlLOvgaJpZM4JxDzm .

ozan commented 8 years ago

Another interesting problem is bracket push. This appears to be a hard problem to solve in any language, until the student decides to use a stack, at which point it would be straightforward even in asm. Similarly once the student knows how to implement a circular buffer or deque, a problem that requires breadth first traversal is just as approachable in asm as in a high level language. Something like the bucket problem could be a good example.

On Wednesday, August 31, 2016, Ozan Onay ozan.onay@gmail.com wrote:

Hey there! These are great choices. I agree that many of the standard exercise problems involve a lot of branchy string manipulation work or require libraries for functionality like Georgian dates. After implementing these it may make sense to add new problems that suit lower level programming. For instance we could add some of the exercises from K&R C.

Regarding nucleotide count, your strategy would be fine, or the caller could just specify a memory location at which it expects the callee to write four ints. If we maxed each count out at 256 we could even cram it all into one register :)

On Tuesday, August 30, 2016, mpriestman <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Issue to just discuss possible problems that could be added to the MIPS track. Looking down the list of available ones from other languages ( http://exercism.io/languages/mips/contribute), a lot seem just too hard for assembly (a lot involve string or data structure manipulation). However, I think there are still some that could make the transition to assembly. The following could be good candidates:

  • difference-of-squares - seems pretty straightforward, single integer input, single integer output.
  • nucleotide-count - simple input, but needs to return 4 integer values. Could use hi and lo parts of v0 and v1?
  • atbash-cipher - single string input, fixed size string output.
  • luhn - could make for an interesting challenge, string input, boolean result.
  • pangram - pretty similar to the isogram problem.
  • binary-search - could be fun too.

Could also try to come up with some new exercises just for the MIPS track that are more "assembly-like".

Any thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/exercism/xmips/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG6z-Ldh956TKCwD--x-3TU79YuqKRMks5qlLOvgaJpZM4JxDzm .

mpriestman commented 8 years ago

When I implemented the raindrops problem, I ended up writing a version of a couple of C functions (itoa, and strcat). As you mentioned above, these in themselves could make good exercises; pretty small and self-contained, easy to test, and once the student is happy with them, then could open the door to using them in more complicated solutions.

Might only want a couple of interesting ones though. For example, is strlen too easy? strdup is also pretty straightforward, but would involve a memory allocation. itoa is pretty meaty, and there are a few ways to solve it too.

mpriestman commented 8 years ago

I like your idea of putting four results into a single register for the nucleotide count problem. A good example of packing smaller values into a large value.

mpriestman commented 8 years ago

I've put in a PR for difference-of-squares, and having "a bash" at atbash-cipher.

qjd2413 commented 8 years ago

Certain exercises that require string computation seem doable, such as anagram or potentially bob.

In regards to dates, assembly has 4 input registers-- month, day, and year could be passed in through different registers. Assuming the response is either a string or integer, I think a problem like gigasecond would be useful (and a good application of an implementation of a "switch/case statement"). Edit: Thinking more about gigasecond and time in general, it seems like too much of a hassle to implement (no current time, no simple way to return more than two values)

keiravillekode commented 4 months ago

I agree that gigasecond is not worth implementing. Of the exercises discussed in this thread, only anagram and two-bucket remain to be implemented.