Can Jimmy hang on his rope?Will Jimmy fall off his platform?How many Jimmys can fit?Jimmy needs your help!Count the bytes of a programCenter The Text!Analyse your ChairSplit a Shakespeare ScriptJimmy these arrays downNo strings attached!Would this string work as string?Will Jimmy fall off his platform?How many Jimmys can fit?Jimmy needs your help!
Need a non-volatile memory IC with near unlimited read/write operations capability
How do ballistic trajectories work in a ring world?
How do I separate enchants from items?
Why do people prefer metropolitan areas, considering monsters and villains?
How can I review my manager, who is fine?
Can "expliquer" be followed by "que" and the subjunctive?
Can one block with a protection from color creature?
Why is a semiprime used as the modulus in RSA?
Why won't the U.S. sign a peace treaty with North Korea?
How to use Adostop Eco stop bath?
Wires do not connect in Circuitikz
Tesco's Burger Relish Best Before End date number
US citizen traveling with Peruvian passport
How do I talk to my wife about unrealistic expectations?
What does "spinning upon the shoals" mean?
How do I explain that I don't want to maintain old projects?
Computer name naming convention for security
Why did Old English lose both thorn and eth?
I'm feeling like my character doesn't fit the campaign
A ring of generalized power series
What exactly is a "murder hobo"?
Moving millions of files to a different directory with specfic name patterns
How many Jimmys can fit?
Publishing papers seem natural to many, while I find it really hard to think novel stuff to pursue till publication. How to cope up with this?
Can Jimmy hang on his rope?
Will Jimmy fall off his platform?How many Jimmys can fit?Jimmy needs your help!Count the bytes of a programCenter The Text!Analyse your ChairSplit a Shakespeare ScriptJimmy these arrays downNo strings attached!Would this string work as string?Will Jimmy fall off his platform?How many Jimmys can fit?Jimmy needs your help!
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
Yet another Jimmy challenge by his original father. See these other lovely challenges.
As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve.
One of these tricks is hanging by ropes. Here's an example of a rope Jimmy could hang from:
||
||
||
||
||
||
When Jimmy hangs on a rope, it looks like this:
||
||
/o
||
||
||
He can hang on the left or the right of the rope, so this:
||
||
||
/o
||
||
is also valid. But he cannot hang by just one body part, so anything like this:
||
||
||
/o|
||
||
is invalid. Note that when he is hanging by one body part the other half of the rope is visible because Jimmy does not cover it up.
Also, Jimmy does not like hanging on the bottom of the rope - it scares him - so this:
||
||
||
||
||
/o
is invalid.
The challenge
Take input of a Jimmy situation like the ones above, and output whether Jimmy will hang on to the rope or not through a truthy or falsy value.
The specifics
Write a program that takes input. This can be through a function or any other appropriate input method.
- The input should be a scene of one Jimmy and a rope as exemplified above.
The program should output a truthy or falsy value to the console based on whether Jimmy can hang on to the rope or if he would fall off the rope, respectively.
The criteria for Jimmy being able to hang on the rope:
Two of his body parts are on the rope.
He is not on the bottom of the rope.
He is not floating in mid-air.
You can assume the rope will be straight, made up of
||
segments, and will be longer than one character in height.You can assume one whole rope and one singular Jimmy will be present in your scene, no more and no less.
You can assume there will be no trailing newlines at the bottom of the rope.
You must cover any amount of leading or trailing spaces before and after the rope.
Test cases
||
||
|| TRUTHY
/o
||
||
||
||
/o| FALSY
||
||
||
/o TRUTHY
||
||
/o FALSY
/o
|| TRUTHY
||
||
/o || FALSY
||
||
Scoring
This is code-golf, so lowest score in bytes wins after about a week.
Leaderboard
You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (# header text
) with the following info:
The name of the language (end it with a comma
,
or dash-
), followed by...The byte count, as the last number to appear in your header.
For example, JavaScript (ES6), 72 bytes
is valid, but Fortran, 143 bytes (8-bit)
is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this).
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
code-golf string ascii-art parsing
$endgroup$
|
show 1 more comment
$begingroup$
Yet another Jimmy challenge by his original father. See these other lovely challenges.
As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve.
One of these tricks is hanging by ropes. Here's an example of a rope Jimmy could hang from:
||
||
||
||
||
||
When Jimmy hangs on a rope, it looks like this:
||
||
/o
||
||
||
He can hang on the left or the right of the rope, so this:
||
||
||
/o
||
||
is also valid. But he cannot hang by just one body part, so anything like this:
||
||
||
/o|
||
||
is invalid. Note that when he is hanging by one body part the other half of the rope is visible because Jimmy does not cover it up.
Also, Jimmy does not like hanging on the bottom of the rope - it scares him - so this:
||
||
||
||
||
/o
is invalid.
The challenge
Take input of a Jimmy situation like the ones above, and output whether Jimmy will hang on to the rope or not through a truthy or falsy value.
The specifics
Write a program that takes input. This can be through a function or any other appropriate input method.
- The input should be a scene of one Jimmy and a rope as exemplified above.
The program should output a truthy or falsy value to the console based on whether Jimmy can hang on to the rope or if he would fall off the rope, respectively.
The criteria for Jimmy being able to hang on the rope:
Two of his body parts are on the rope.
He is not on the bottom of the rope.
He is not floating in mid-air.
You can assume the rope will be straight, made up of
||
segments, and will be longer than one character in height.You can assume one whole rope and one singular Jimmy will be present in your scene, no more and no less.
You can assume there will be no trailing newlines at the bottom of the rope.
You must cover any amount of leading or trailing spaces before and after the rope.
Test cases
||
||
|| TRUTHY
/o
||
||
||
||
/o| FALSY
||
||
||
/o TRUTHY
||
||
/o FALSY
/o
|| TRUTHY
||
||
/o || FALSY
||
||
Scoring
This is code-golf, so lowest score in bytes wins after about a week.
Leaderboard
You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (# header text
) with the following info:
The name of the language (end it with a comma
,
or dash-
), followed by...The byte count, as the last number to appear in your header.
For example, JavaScript (ES6), 72 bytes
is valid, but Fortran, 143 bytes (8-bit)
is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this).
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
code-golf string ascii-art parsing
$endgroup$
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
6
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
1
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago
|
show 1 more comment
$begingroup$
Yet another Jimmy challenge by his original father. See these other lovely challenges.
As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve.
One of these tricks is hanging by ropes. Here's an example of a rope Jimmy could hang from:
||
||
||
||
||
||
When Jimmy hangs on a rope, it looks like this:
||
||
/o
||
||
||
He can hang on the left or the right of the rope, so this:
||
||
||
/o
||
||
is also valid. But he cannot hang by just one body part, so anything like this:
||
||
||
/o|
||
||
is invalid. Note that when he is hanging by one body part the other half of the rope is visible because Jimmy does not cover it up.
Also, Jimmy does not like hanging on the bottom of the rope - it scares him - so this:
||
||
||
||
||
/o
is invalid.
The challenge
Take input of a Jimmy situation like the ones above, and output whether Jimmy will hang on to the rope or not through a truthy or falsy value.
The specifics
Write a program that takes input. This can be through a function or any other appropriate input method.
- The input should be a scene of one Jimmy and a rope as exemplified above.
The program should output a truthy or falsy value to the console based on whether Jimmy can hang on to the rope or if he would fall off the rope, respectively.
The criteria for Jimmy being able to hang on the rope:
Two of his body parts are on the rope.
He is not on the bottom of the rope.
He is not floating in mid-air.
You can assume the rope will be straight, made up of
||
segments, and will be longer than one character in height.You can assume one whole rope and one singular Jimmy will be present in your scene, no more and no less.
You can assume there will be no trailing newlines at the bottom of the rope.
You must cover any amount of leading or trailing spaces before and after the rope.
Test cases
||
||
|| TRUTHY
/o
||
||
||
||
/o| FALSY
||
||
||
/o TRUTHY
||
||
/o FALSY
/o
|| TRUTHY
||
||
/o || FALSY
||
||
Scoring
This is code-golf, so lowest score in bytes wins after about a week.
Leaderboard
You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (# header text
) with the following info:
The name of the language (end it with a comma
,
or dash-
), followed by...The byte count, as the last number to appear in your header.
For example, JavaScript (ES6), 72 bytes
is valid, but Fortran, 143 bytes (8-bit)
is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this).
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
code-golf string ascii-art parsing
$endgroup$
Yet another Jimmy challenge by his original father. See these other lovely challenges.
As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve.
One of these tricks is hanging by ropes. Here's an example of a rope Jimmy could hang from:
||
||
||
||
||
||
When Jimmy hangs on a rope, it looks like this:
||
||
/o
||
||
||
He can hang on the left or the right of the rope, so this:
||
||
||
/o
||
||
is also valid. But he cannot hang by just one body part, so anything like this:
||
||
||
/o|
||
||
is invalid. Note that when he is hanging by one body part the other half of the rope is visible because Jimmy does not cover it up.
Also, Jimmy does not like hanging on the bottom of the rope - it scares him - so this:
||
||
||
||
||
/o
is invalid.
The challenge
Take input of a Jimmy situation like the ones above, and output whether Jimmy will hang on to the rope or not through a truthy or falsy value.
The specifics
Write a program that takes input. This can be through a function or any other appropriate input method.
- The input should be a scene of one Jimmy and a rope as exemplified above.
The program should output a truthy or falsy value to the console based on whether Jimmy can hang on to the rope or if he would fall off the rope, respectively.
The criteria for Jimmy being able to hang on the rope:
Two of his body parts are on the rope.
He is not on the bottom of the rope.
He is not floating in mid-air.
You can assume the rope will be straight, made up of
||
segments, and will be longer than one character in height.You can assume one whole rope and one singular Jimmy will be present in your scene, no more and no less.
You can assume there will be no trailing newlines at the bottom of the rope.
You must cover any amount of leading or trailing spaces before and after the rope.
Test cases
||
||
|| TRUTHY
/o
||
||
||
||
/o| FALSY
||
||
||
/o TRUTHY
||
||
/o FALSY
/o
|| TRUTHY
||
||
/o || FALSY
||
||
Scoring
This is code-golf, so lowest score in bytes wins after about a week.
Leaderboard
You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (# header text
) with the following info:
The name of the language (end it with a comma
,
or dash-
), followed by...The byte count, as the last number to appear in your header.
For example, JavaScript (ES6), 72 bytes
is valid, but Fortran, 143 bytes (8-bit)
is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this).
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187759" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,bodymargin:0;padding:0;height:100%;overflow:hidden</style>
code-golf string ascii-art parsing
code-golf string ascii-art parsing
edited 7 hours ago
Glorfindel
2331 gold badge3 silver badges9 bronze badges
2331 gold badge3 silver badges9 bronze badges
asked 8 hours ago
connectyourchargerconnectyourcharger
6241 gold badge3 silver badges17 bronze badges
6241 gold badge3 silver badges17 bronze badges
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
6
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
1
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago
|
show 1 more comment
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
6
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
1
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
6
6
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
1
1
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago
|
show 1 more comment
10 Answers
10
active
oldest
votes
$begingroup$
Python 3, 41 bytes
lambda x:any("|"not in i for i in x[:-1])
A function that takes input as a list of strings, each string being a different line.
-11 bytes thanks to xnor!
Try it online! (If you want to try more test cases, just put a "." after each set of lines in the input box.)
Takes advantage of the fact that if Jimmy is fully on the rope, no parts of the rope (no "|") will be showing. It checks if there are any lines that do not have "|", which means that Jimmy is fully on the rope.
New contributor
$endgroup$
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
add a comment |
$begingroup$
Python 2 or 3, 33 bytes
lambda l:min(map(max,l[:-1]))<'|'
An unnamed function accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
lambda l:min(map(max,l[:-1]))<'|'
lambda l: - a function taking l (the lines as strings)
l[:-1] - strip off the last line
map(max, ) - maximum of each line (where '|'>'o'>''>'/'>' ')
min( ) - minimum
<'|' - is less than '|' (hence not rope since '|' is maximal)
$endgroup$
add a comment |
$begingroup$
Jelly, 9 7 6 bytes
Ṗ<”|ṀẠ
A monadic Link accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
Ṗ<”|ṀẠ - Main Link: list of lines of characters
Ṗ - remove last line
”| - pipe character
< - less than? (vectorises) - Note that all other characters are
Ṁ - maximum
Ạ - all?
$endgroup$
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"Note that all other characters are [less than '|']
"?
$endgroup$
– Erik the Outgolfer
5 hours ago
|
show 1 more comment
$begingroup$
JavaScript, 39 33 bytes
Thanks @Daniil Tutubalin for golfing off 2 bytes
x=>!!x.match(/^( *)/[^|]*n/m)
This matches any line which is not the line where his left arm shows up and none of the rope shows.
Try it online!
$endgroup$
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically!!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.
$endgroup$
– Daniil Tutubalin
3 hours ago
add a comment |
$begingroup$
JavaScript, 38 37 bytes
r=>r.some(x=>!~x.search`\|`,r.pop())
Try it online!
$endgroup$
add a comment |
$begingroup$
Befunge-98 (PyFunge), 26 bytes
>#@~:a-!#v_' `+
^ 0_-3q#$<
Try it online!
Exits with return code 3 if n
is encountered and the last line contained 3 non-space characters, otherwise exits with return code 0 on EOF. Thus, this relies on the last line not containing a trailing newline.
Dissected
>#@~ :a-!#v_ ' `+
Read character, Branch downwards if Increment counter on
return with code 0 equal to 10 ('n') the stack if greater
if end of stream than 32 (' ') and
implicitly loop
^ 0_-3q#$ <
Return with code 3
if counter is equal to 3,
otherwise reset counter
and return to beginning
$endgroup$
add a comment |
$begingroup$
Pyth, 9 bytes
sPm!sqR|
Test suite!
$endgroup$
add a comment |
$begingroup$
Retina, 9 bytes
m`^[^|]+^
Try it online!
Now, I've never programmed in Retina before, but as far as I can tell this works. It is a regular expression that finds a string containing (1) the beginning of the input, (2) no "|" characters, and (3) a newline.
People more familiar with either regular expressions or Retina are encouraged to offer suggestions. -2 bytes thanks to Neil!
New contributor
$endgroup$
$begingroup$
Two alternatives: 1) Remove then
because a new line is not a|
and so that will match anyway, and the final^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow¶
instead ofn
and remove the trailing^
(because that's always true after a newline in multiline mode).
$endgroup$
– Neil
6 hours ago
add a comment |
$begingroup$
Dyalog APL Extended, 14 13 11 bytes
3∊+/<¯1↓⍵
Try it online!
$endgroup$
add a comment |
$begingroup$
Stax, 6 bytes
é¿┤4╠q
Run and debug it
Transposes the input, then searches for "o|".
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187759%2fcan-jimmy-hang-on-his-rope%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Python 3, 41 bytes
lambda x:any("|"not in i for i in x[:-1])
A function that takes input as a list of strings, each string being a different line.
-11 bytes thanks to xnor!
Try it online! (If you want to try more test cases, just put a "." after each set of lines in the input box.)
Takes advantage of the fact that if Jimmy is fully on the rope, no parts of the rope (no "|") will be showing. It checks if there are any lines that do not have "|", which means that Jimmy is fully on the rope.
New contributor
$endgroup$
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
add a comment |
$begingroup$
Python 3, 41 bytes
lambda x:any("|"not in i for i in x[:-1])
A function that takes input as a list of strings, each string being a different line.
-11 bytes thanks to xnor!
Try it online! (If you want to try more test cases, just put a "." after each set of lines in the input box.)
Takes advantage of the fact that if Jimmy is fully on the rope, no parts of the rope (no "|") will be showing. It checks if there are any lines that do not have "|", which means that Jimmy is fully on the rope.
New contributor
$endgroup$
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
add a comment |
$begingroup$
Python 3, 41 bytes
lambda x:any("|"not in i for i in x[:-1])
A function that takes input as a list of strings, each string being a different line.
-11 bytes thanks to xnor!
Try it online! (If you want to try more test cases, just put a "." after each set of lines in the input box.)
Takes advantage of the fact that if Jimmy is fully on the rope, no parts of the rope (no "|") will be showing. It checks if there are any lines that do not have "|", which means that Jimmy is fully on the rope.
New contributor
$endgroup$
Python 3, 41 bytes
lambda x:any("|"not in i for i in x[:-1])
A function that takes input as a list of strings, each string being a different line.
-11 bytes thanks to xnor!
Try it online! (If you want to try more test cases, just put a "." after each set of lines in the input box.)
Takes advantage of the fact that if Jimmy is fully on the rope, no parts of the rope (no "|") will be showing. It checks if there are any lines that do not have "|", which means that Jimmy is fully on the rope.
New contributor
edited 7 hours ago
New contributor
answered 7 hours ago
MaxwellMaxwell
2714 bronze badges
2714 bronze badges
New contributor
New contributor
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
add a comment |
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
Can you do it without the check that the line has a "/"?
$endgroup$
– xnor
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
@xnor Yup! -11 bytes
$endgroup$
– Maxwell
7 hours ago
$begingroup$
Save a couple like so:
lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
Save a couple like so:
lambda x:1-all("|"in i for i in x[:-1])
$endgroup$
– Jonathan Allan
7 hours ago
1
1
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
$begingroup$
Ouch, you was faster :)
$endgroup$
– Daniil Tutubalin
6 hours ago
add a comment |
$begingroup$
Python 2 or 3, 33 bytes
lambda l:min(map(max,l[:-1]))<'|'
An unnamed function accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
lambda l:min(map(max,l[:-1]))<'|'
lambda l: - a function taking l (the lines as strings)
l[:-1] - strip off the last line
map(max, ) - maximum of each line (where '|'>'o'>''>'/'>' ')
min( ) - minimum
<'|' - is less than '|' (hence not rope since '|' is maximal)
$endgroup$
add a comment |
$begingroup$
Python 2 or 3, 33 bytes
lambda l:min(map(max,l[:-1]))<'|'
An unnamed function accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
lambda l:min(map(max,l[:-1]))<'|'
lambda l: - a function taking l (the lines as strings)
l[:-1] - strip off the last line
map(max, ) - maximum of each line (where '|'>'o'>''>'/'>' ')
min( ) - minimum
<'|' - is less than '|' (hence not rope since '|' is maximal)
$endgroup$
add a comment |
$begingroup$
Python 2 or 3, 33 bytes
lambda l:min(map(max,l[:-1]))<'|'
An unnamed function accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
lambda l:min(map(max,l[:-1]))<'|'
lambda l: - a function taking l (the lines as strings)
l[:-1] - strip off the last line
map(max, ) - maximum of each line (where '|'>'o'>''>'/'>' ')
min( ) - minimum
<'|' - is less than '|' (hence not rope since '|' is maximal)
$endgroup$
Python 2 or 3, 33 bytes
lambda l:min(map(max,l[:-1]))<'|'
An unnamed function accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
lambda l:min(map(max,l[:-1]))<'|'
lambda l: - a function taking l (the lines as strings)
l[:-1] - strip off the last line
map(max, ) - maximum of each line (where '|'>'o'>''>'/'>' ')
min( ) - minimum
<'|' - is less than '|' (hence not rope since '|' is maximal)
edited 6 hours ago
answered 6 hours ago
Jonathan AllanJonathan Allan
56.7k5 gold badges41 silver badges178 bronze badges
56.7k5 gold badges41 silver badges178 bronze badges
add a comment |
add a comment |
$begingroup$
Jelly, 9 7 6 bytes
Ṗ<”|ṀẠ
A monadic Link accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
Ṗ<”|ṀẠ - Main Link: list of lines of characters
Ṗ - remove last line
”| - pipe character
< - less than? (vectorises) - Note that all other characters are
Ṁ - maximum
Ạ - all?
$endgroup$
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"Note that all other characters are [less than '|']
"?
$endgroup$
– Erik the Outgolfer
5 hours ago
|
show 1 more comment
$begingroup$
Jelly, 9 7 6 bytes
Ṗ<”|ṀẠ
A monadic Link accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
Ṗ<”|ṀẠ - Main Link: list of lines of characters
Ṗ - remove last line
”| - pipe character
< - less than? (vectorises) - Note that all other characters are
Ṁ - maximum
Ạ - all?
$endgroup$
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"Note that all other characters are [less than '|']
"?
$endgroup$
– Erik the Outgolfer
5 hours ago
|
show 1 more comment
$begingroup$
Jelly, 9 7 6 bytes
Ṗ<”|ṀẠ
A monadic Link accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
Ṗ<”|ṀẠ - Main Link: list of lines of characters
Ṗ - remove last line
”| - pipe character
< - less than? (vectorises) - Note that all other characters are
Ṁ - maximum
Ạ - all?
$endgroup$
Jelly, 9 7 6 bytes
Ṗ<”|ṀẠ
A monadic Link accepting a list of lines
Try it online!
How?
There needs to be a section of rope obscured by Jimmy that is not the bottom one.
Ṗ<”|ṀẠ - Main Link: list of lines of characters
Ṗ - remove last line
”| - pipe character
< - less than? (vectorises) - Note that all other characters are
Ṁ - maximum
Ạ - all?
edited 6 hours ago
answered 8 hours ago
Jonathan AllanJonathan Allan
56.7k5 gold badges41 silver badges178 bronze badges
56.7k5 gold badges41 silver badges178 bronze badges
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"Note that all other characters are [less than '|']
"?
$endgroup$
– Erik the Outgolfer
5 hours ago
|
show 1 more comment
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"Note that all other characters are [less than '|']
"?
$endgroup$
– Erik the Outgolfer
5 hours ago
1
1
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
I feel so weird writing these challenges about Jimmies. It starts to make you feel weird once you imagine multiple Jimmies hanging off of the same rope.
$endgroup$
– connectyourcharger
8 hours ago
1
1
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@connectyourcharger Foreshadowing?
$endgroup$
– negative seven
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
@negativeseven Possibly. I have already considered a meta community wiki to index all of the Jimmy posts.
$endgroup$
– connectyourcharger
8 hours ago
1
1
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
Nine bytes, and once again, we still find out how someone can die.
$endgroup$
– IMustBeSomeone
7 hours ago
$begingroup$
"
Note that all other characters are [less than '|']
"?$endgroup$
– Erik the Outgolfer
5 hours ago
$begingroup$
"
Note that all other characters are [less than '|']
"?$endgroup$
– Erik the Outgolfer
5 hours ago
|
show 1 more comment
$begingroup$
JavaScript, 39 33 bytes
Thanks @Daniil Tutubalin for golfing off 2 bytes
x=>!!x.match(/^( *)/[^|]*n/m)
This matches any line which is not the line where his left arm shows up and none of the rope shows.
Try it online!
$endgroup$
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically!!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.
$endgroup$
– Daniil Tutubalin
3 hours ago
add a comment |
$begingroup$
JavaScript, 39 33 bytes
Thanks @Daniil Tutubalin for golfing off 2 bytes
x=>!!x.match(/^( *)/[^|]*n/m)
This matches any line which is not the line where his left arm shows up and none of the rope shows.
Try it online!
$endgroup$
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically!!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.
$endgroup$
– Daniil Tutubalin
3 hours ago
add a comment |
$begingroup$
JavaScript, 39 33 bytes
Thanks @Daniil Tutubalin for golfing off 2 bytes
x=>!!x.match(/^( *)/[^|]*n/m)
This matches any line which is not the line where his left arm shows up and none of the rope shows.
Try it online!
$endgroup$
JavaScript, 39 33 bytes
Thanks @Daniil Tutubalin for golfing off 2 bytes
x=>!!x.match(/^( *)/[^|]*n/m)
This matches any line which is not the line where his left arm shows up and none of the rope shows.
Try it online!
edited 1 hour ago
answered 7 hours ago
fəˈnɛtɪkfəˈnɛtɪk
3,7062 gold badges6 silver badges37 bronze badges
3,7062 gold badges6 silver badges37 bronze badges
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically!!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.
$endgroup$
– Daniil Tutubalin
3 hours ago
add a comment |
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically!!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.
$endgroup$
– Daniil Tutubalin
3 hours ago
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It appears to fail if he is at the bottom of the rope
$endgroup$
– fəˈnɛtɪk
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
It should fail if he is at the bottom, right? Because Jimmy falls if he is at the bottom fo the rope
$endgroup$
– Maxwell
7 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
I mean that when I put him at the bottom of the rope your function for some reason returned 1
$endgroup$
– fəˈnɛtɪk
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Hm, nevermind then.
$endgroup$
– Maxwell
6 hours ago
$begingroup$
Minus 2 bytes:
x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically !!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.$endgroup$
– Daniil Tutubalin
3 hours ago
$begingroup$
Minus 2 bytes:
x=>!!x.match(/^( *)/o\ *n1 ?|/m)
But basically !!
is not required because valid object is truthy value and null is falsy value, so you can make even minus 4.$endgroup$
– Daniil Tutubalin
3 hours ago
add a comment |
$begingroup$
JavaScript, 38 37 bytes
r=>r.some(x=>!~x.search`\|`,r.pop())
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript, 38 37 bytes
r=>r.some(x=>!~x.search`\|`,r.pop())
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript, 38 37 bytes
r=>r.some(x=>!~x.search`\|`,r.pop())
Try it online!
$endgroup$
JavaScript, 38 37 bytes
r=>r.some(x=>!~x.search`\|`,r.pop())
Try it online!
edited 6 hours ago
answered 6 hours ago
Daniil TutubalinDaniil Tutubalin
1827 bronze badges
1827 bronze badges
add a comment |
add a comment |
$begingroup$
Befunge-98 (PyFunge), 26 bytes
>#@~:a-!#v_' `+
^ 0_-3q#$<
Try it online!
Exits with return code 3 if n
is encountered and the last line contained 3 non-space characters, otherwise exits with return code 0 on EOF. Thus, this relies on the last line not containing a trailing newline.
Dissected
>#@~ :a-!#v_ ' `+
Read character, Branch downwards if Increment counter on
return with code 0 equal to 10 ('n') the stack if greater
if end of stream than 32 (' ') and
implicitly loop
^ 0_-3q#$ <
Return with code 3
if counter is equal to 3,
otherwise reset counter
and return to beginning
$endgroup$
add a comment |
$begingroup$
Befunge-98 (PyFunge), 26 bytes
>#@~:a-!#v_' `+
^ 0_-3q#$<
Try it online!
Exits with return code 3 if n
is encountered and the last line contained 3 non-space characters, otherwise exits with return code 0 on EOF. Thus, this relies on the last line not containing a trailing newline.
Dissected
>#@~ :a-!#v_ ' `+
Read character, Branch downwards if Increment counter on
return with code 0 equal to 10 ('n') the stack if greater
if end of stream than 32 (' ') and
implicitly loop
^ 0_-3q#$ <
Return with code 3
if counter is equal to 3,
otherwise reset counter
and return to beginning
$endgroup$
add a comment |
$begingroup$
Befunge-98 (PyFunge), 26 bytes
>#@~:a-!#v_' `+
^ 0_-3q#$<
Try it online!
Exits with return code 3 if n
is encountered and the last line contained 3 non-space characters, otherwise exits with return code 0 on EOF. Thus, this relies on the last line not containing a trailing newline.
Dissected
>#@~ :a-!#v_ ' `+
Read character, Branch downwards if Increment counter on
return with code 0 equal to 10 ('n') the stack if greater
if end of stream than 32 (' ') and
implicitly loop
^ 0_-3q#$ <
Return with code 3
if counter is equal to 3,
otherwise reset counter
and return to beginning
$endgroup$
Befunge-98 (PyFunge), 26 bytes
>#@~:a-!#v_' `+
^ 0_-3q#$<
Try it online!
Exits with return code 3 if n
is encountered and the last line contained 3 non-space characters, otherwise exits with return code 0 on EOF. Thus, this relies on the last line not containing a trailing newline.
Dissected
>#@~ :a-!#v_ ' `+
Read character, Branch downwards if Increment counter on
return with code 0 equal to 10 ('n') the stack if greater
if end of stream than 32 (' ') and
implicitly loop
^ 0_-3q#$ <
Return with code 3
if counter is equal to 3,
otherwise reset counter
and return to beginning
answered 6 hours ago
negative sevennegative seven
5812 silver badges8 bronze badges
5812 silver badges8 bronze badges
add a comment |
add a comment |
$begingroup$
Pyth, 9 bytes
sPm!sqR|
Test suite!
$endgroup$
add a comment |
$begingroup$
Pyth, 9 bytes
sPm!sqR|
Test suite!
$endgroup$
add a comment |
$begingroup$
Pyth, 9 bytes
sPm!sqR|
Test suite!
$endgroup$
Pyth, 9 bytes
sPm!sqR|
Test suite!
answered 6 hours ago
Mr. XcoderMr. Xcoder
32.6k7 gold badges61 silver badges202 bronze badges
32.6k7 gold badges61 silver badges202 bronze badges
add a comment |
add a comment |
$begingroup$
Retina, 9 bytes
m`^[^|]+^
Try it online!
Now, I've never programmed in Retina before, but as far as I can tell this works. It is a regular expression that finds a string containing (1) the beginning of the input, (2) no "|" characters, and (3) a newline.
People more familiar with either regular expressions or Retina are encouraged to offer suggestions. -2 bytes thanks to Neil!
New contributor
$endgroup$
$begingroup$
Two alternatives: 1) Remove then
because a new line is not a|
and so that will match anyway, and the final^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow¶
instead ofn
and remove the trailing^
(because that's always true after a newline in multiline mode).
$endgroup$
– Neil
6 hours ago
add a comment |
$begingroup$
Retina, 9 bytes
m`^[^|]+^
Try it online!
Now, I've never programmed in Retina before, but as far as I can tell this works. It is a regular expression that finds a string containing (1) the beginning of the input, (2) no "|" characters, and (3) a newline.
People more familiar with either regular expressions or Retina are encouraged to offer suggestions. -2 bytes thanks to Neil!
New contributor
$endgroup$
$begingroup$
Two alternatives: 1) Remove then
because a new line is not a|
and so that will match anyway, and the final^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow¶
instead ofn
and remove the trailing^
(because that's always true after a newline in multiline mode).
$endgroup$
– Neil
6 hours ago
add a comment |
$begingroup$
Retina, 9 bytes
m`^[^|]+^
Try it online!
Now, I've never programmed in Retina before, but as far as I can tell this works. It is a regular expression that finds a string containing (1) the beginning of the input, (2) no "|" characters, and (3) a newline.
People more familiar with either regular expressions or Retina are encouraged to offer suggestions. -2 bytes thanks to Neil!
New contributor
$endgroup$
Retina, 9 bytes
m`^[^|]+^
Try it online!
Now, I've never programmed in Retina before, but as far as I can tell this works. It is a regular expression that finds a string containing (1) the beginning of the input, (2) no "|" characters, and (3) a newline.
People more familiar with either regular expressions or Retina are encouraged to offer suggestions. -2 bytes thanks to Neil!
New contributor
edited 6 hours ago
New contributor
answered 6 hours ago
MaxwellMaxwell
2714 bronze badges
2714 bronze badges
New contributor
New contributor
$begingroup$
Two alternatives: 1) Remove then
because a new line is not a|
and so that will match anyway, and the final^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow¶
instead ofn
and remove the trailing^
(because that's always true after a newline in multiline mode).
$endgroup$
– Neil
6 hours ago
add a comment |
$begingroup$
Two alternatives: 1) Remove then
because a new line is not a|
and so that will match anyway, and the final^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow¶
instead ofn
and remove the trailing^
(because that's always true after a newline in multiline mode).
$endgroup$
– Neil
6 hours ago
$begingroup$
Two alternatives: 1) Remove the
n
because a new line is not a |
and so that will match anyway, and the final ^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow ¶
instead of n
and remove the trailing ^
(because that's always true after a newline in multiline mode).$endgroup$
– Neil
6 hours ago
$begingroup$
Two alternatives: 1) Remove the
n
because a new line is not a |
and so that will match anyway, and the final ^
suffices to ensure that you actually matched a newline. 2) Use a pilcrow ¶
instead of n
and remove the trailing ^
(because that's always true after a newline in multiline mode).$endgroup$
– Neil
6 hours ago
add a comment |
$begingroup$
Dyalog APL Extended, 14 13 11 bytes
3∊+/<¯1↓⍵
Try it online!
$endgroup$
add a comment |
$begingroup$
Dyalog APL Extended, 14 13 11 bytes
3∊+/<¯1↓⍵
Try it online!
$endgroup$
add a comment |
$begingroup$
Dyalog APL Extended, 14 13 11 bytes
3∊+/<¯1↓⍵
Try it online!
$endgroup$
Dyalog APL Extended, 14 13 11 bytes
3∊+/<¯1↓⍵
Try it online!
edited 4 hours ago
answered 4 hours ago
dzaimadzaima
16.9k2 gold badges26 silver badges64 bronze badges
16.9k2 gold badges26 silver badges64 bronze badges
add a comment |
add a comment |
$begingroup$
Stax, 6 bytes
é¿┤4╠q
Run and debug it
Transposes the input, then searches for "o|".
$endgroup$
add a comment |
$begingroup$
Stax, 6 bytes
é¿┤4╠q
Run and debug it
Transposes the input, then searches for "o|".
$endgroup$
add a comment |
$begingroup$
Stax, 6 bytes
é¿┤4╠q
Run and debug it
Transposes the input, then searches for "o|".
$endgroup$
Stax, 6 bytes
é¿┤4╠q
Run and debug it
Transposes the input, then searches for "o|".
answered 2 hours ago
recursiverecursive
6,93914 silver badges27 bronze badges
6,93914 silver badges27 bronze badges
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187759%2fcan-jimmy-hang-on-his-rope%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Is the rope always going to have the same number of spaces before it, or can that vary?
$endgroup$
– Maxwell
8 hours ago
$begingroup$
@Maxwell That can vary.
$endgroup$
– connectyourcharger
8 hours ago
$begingroup$
Can we take the input as something like a list, where each line is a separate string, or does it have to be one single string?
$endgroup$
– Maxwell
8 hours ago
6
$begingroup$
Jimmy should really take a holiday
$endgroup$
– Luis Mendo
7 hours ago
1
$begingroup$
@LuisMendo Jimmy is dedicated to what he does!
$endgroup$
– connectyourcharger
7 hours ago