Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

We're back We're back in London!

We're back in London!

We're back in London!

added 29 characters in body
Source Link
Timwi
  • 13k
  • 3
  • 46
  • 66

Timwi was so kind to implement the control flow stations Temple and Angel in his reference implementationEsoteric IDE as well as add input and integer parsing to the language specification.

Timwi was so kind to implement the control flow stations Temple and Angel in his reference implementation as well as input and integer parsing to the language specification.

Timwi was so kind to implement the control flow stations Temple and Angel in Esoteric IDE as well as add input and integer parsing to the language specification.

added some commas here and there, changed wording to what I believe sounds better
Source Link

Timwi was so kind to implement the control flow stations Temple and Angel in his reference implementation and also andas well as input and integer parsing to the language specification.

This one is probably better golfed than the "Hello, World!", because this time I wrote a CJam script to help me find the shortest path between any two stations. If you want to use it (although I don't know why anyone would want to...), you can use the online interpreter. Paste this code:

Here the first two lines are the stations you want to check. AndAlso, paste the contents of this pastebin into the input window.

As for the actual MC code, it's based on the squared-factorial approach as many other answers, because MC has multiplication, division and modulo and. Also, I figured that a single loop would be convenient.

One issue is that the loops are do-while loops, and decrementing and incrementing is expensive, so I can't easily compute (n-1)! (for n > 0). Instead, I'm computing n! and then divide by n at the end. I'm sure there is a better solution for this.

When I started writing this, I figured that storing -1 in Hammersmith would be a good idea so I can decrement more cheaply, but in the end this may have cost more than it saved. If I find the patience to redo this, I might try just keeping a -1 around in Upminster instead so I can use Hammersmith for something more useful.

Timwi was so kind to implement the control flow stations Temple and Angel in his reference implementation and also and input and integer parsing to the language specification.

This one is probably better golfed than the "Hello, World!", because this time I wrote a CJam script to help me find the shortest path between any two stations. If you want to use (although I don't why anyone would want to...), you can use the online interpreter. Paste this code:

Here the first two lines are the stations you want to check. And paste the contents of this pastebin into the input window.

As for the actual MC code, it's based on the squared-factorial approach as many other answers, because MC has multiplication, division and modulo and I figured that a single loop would be convenient.

One issue is that the loops are do-while loops, and decrementing and incrementing is expensive, so I can't easily compute (n-1)! (for n > 0). Instead I'm computing n! and then divide by n at the end. I'm sure there is a better solution for this.

When I started writing this I figured that storing -1 in Hammersmith would be a good idea so I can decrement more cheaply, but in the end this may have cost more than it saved. If I find the patience to redo this, I might try just keeping a -1 around in Upminster instead so I can use Hammersmith for something more useful.

Timwi was so kind to implement the control flow stations Temple and Angel in his reference implementation as well as input and integer parsing to the language specification.

This one is probably better golfed than the "Hello, World!", because this time I wrote a CJam script to help me find the shortest path between any two stations. If you want to use it (although I don't know why anyone would want to...), you can use the online interpreter. Paste this code:

Here the first two lines are the stations you want to check. Also, paste the contents of this pastebin into the input window.

As for the actual MC code, it's based on the squared-factorial approach as many other answers because MC has multiplication, division and modulo. Also, I figured that a single loop would be convenient.

One issue is that the loops are do-while loops, and decrementing and incrementing is expensive, so I can't easily compute (n-1)! (for n > 0). Instead, I'm computing n! and then divide by n at the end. I'm sure there is a better solution for this.

When I started writing this, I figured that storing -1 in Hammersmith would be a good idea so I can decrement more cheaply, but in the end this may have cost more than it saved. If I find the patience to redo this, I might try just keeping a -1 around in Upminster instead so I can use Hammersmith for something more useful.

Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 998
Loading

AltStyle によって変換されたページ (->オリジナル) /