simplefunge - NilClass error even when top of stack is not null
CODE:
91+I-v
V
O
@
I made this code for a PPCG (Programming Puzzles and Code Golf) submission, but it is not working.
The error code it returns is /opt/simplefunge/simplefunge.rb:53:in
<main>': undefined method
ord' for nil:NilClass (NoMethodError)
Is there any solution to this?
null
add a comment |
CODE:
91+I-v
V
O
@
I made this code for a PPCG (Programming Puzzles and Code Golf) submission, but it is not working.
The error code it returns is /opt/simplefunge/simplefunge.rb:53:in
<main>': undefined method
ord' for nil:NilClass (NoMethodError)
Is there any solution to this?
null
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago
add a comment |
CODE:
91+I-v
V
O
@
I made this code for a PPCG (Programming Puzzles and Code Golf) submission, but it is not working.
The error code it returns is /opt/simplefunge/simplefunge.rb:53:in
<main>': undefined method
ord' for nil:NilClass (NoMethodError)
Is there any solution to this?
null
CODE:
91+I-v
V
O
@
I made this code for a PPCG (Programming Puzzles and Code Golf) submission, but it is not working.
The error code it returns is /opt/simplefunge/simplefunge.rb:53:in
<main>': undefined method
ord' for nil:NilClass (NoMethodError)
Is there any solution to this?
null
null
asked Dec 21 '18 at 14:56
MilkyWay90
3612
3612
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago
add a comment |
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
Your code expects input from stdin with the I command.
If you do not provide input, tio.run provides an empty list. What the error message tells you is that the interpreter could not transform the empty input (nil) into a numeric value through the ord operation, which is defined for characters.
This can be reproduced locally as:
$ echo -n | ruby simplefunge.rb test.funge
Traceback (most recent call last):
simplefunge.rb:53:in `<main>': undefined method `ord' for nil:NilClass (NoMethodError)
To solve this first issue, provide input.
You will get a similar error from the O command in your code, as the previous V operation moves you outside the stack limits, again resulting in trying to apply a character operation on nil when you try to print the stack value as character:
simplefunge.rb:57:in `<main>': undefined method `chr' for nil:NilClass (NoMethodError)
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: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f53886847%2fsimplefunge-nilclass-error-even-when-top-of-stack-is-not-null%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your code expects input from stdin with the I command.
If you do not provide input, tio.run provides an empty list. What the error message tells you is that the interpreter could not transform the empty input (nil) into a numeric value through the ord operation, which is defined for characters.
This can be reproduced locally as:
$ echo -n | ruby simplefunge.rb test.funge
Traceback (most recent call last):
simplefunge.rb:53:in `<main>': undefined method `ord' for nil:NilClass (NoMethodError)
To solve this first issue, provide input.
You will get a similar error from the O command in your code, as the previous V operation moves you outside the stack limits, again resulting in trying to apply a character operation on nil when you try to print the stack value as character:
simplefunge.rb:57:in `<main>': undefined method `chr' for nil:NilClass (NoMethodError)
add a comment |
Your code expects input from stdin with the I command.
If you do not provide input, tio.run provides an empty list. What the error message tells you is that the interpreter could not transform the empty input (nil) into a numeric value through the ord operation, which is defined for characters.
This can be reproduced locally as:
$ echo -n | ruby simplefunge.rb test.funge
Traceback (most recent call last):
simplefunge.rb:53:in `<main>': undefined method `ord' for nil:NilClass (NoMethodError)
To solve this first issue, provide input.
You will get a similar error from the O command in your code, as the previous V operation moves you outside the stack limits, again resulting in trying to apply a character operation on nil when you try to print the stack value as character:
simplefunge.rb:57:in `<main>': undefined method `chr' for nil:NilClass (NoMethodError)
add a comment |
Your code expects input from stdin with the I command.
If you do not provide input, tio.run provides an empty list. What the error message tells you is that the interpreter could not transform the empty input (nil) into a numeric value through the ord operation, which is defined for characters.
This can be reproduced locally as:
$ echo -n | ruby simplefunge.rb test.funge
Traceback (most recent call last):
simplefunge.rb:53:in `<main>': undefined method `ord' for nil:NilClass (NoMethodError)
To solve this first issue, provide input.
You will get a similar error from the O command in your code, as the previous V operation moves you outside the stack limits, again resulting in trying to apply a character operation on nil when you try to print the stack value as character:
simplefunge.rb:57:in `<main>': undefined method `chr' for nil:NilClass (NoMethodError)
Your code expects input from stdin with the I command.
If you do not provide input, tio.run provides an empty list. What the error message tells you is that the interpreter could not transform the empty input (nil) into a numeric value through the ord operation, which is defined for characters.
This can be reproduced locally as:
$ echo -n | ruby simplefunge.rb test.funge
Traceback (most recent call last):
simplefunge.rb:53:in `<main>': undefined method `ord' for nil:NilClass (NoMethodError)
To solve this first issue, provide input.
You will get a similar error from the O command in your code, as the previous V operation moves you outside the stack limits, again resulting in trying to apply a character operation on nil when you try to print the stack value as character:
simplefunge.rb:57:in `<main>': undefined method `chr' for nil:NilClass (NoMethodError)
answered 2 days ago
relet
4,62512635
4,62512635
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2fstackoverflow.com%2fquestions%2f53886847%2fsimplefunge-nilclass-error-even-when-top-of-stack-is-not-null%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
Wow, does no one know simplefunge here?
– MilkyWay90
Dec 28 '18 at 22:39
I'm not able to reproduce your error. Are you using the latest version from github? According to the error and github.com/Aearnus/simplefunge/blob/master/simplefunge.rb#L53 your class STDIN.getc doesn't exist (is nil) while trying to access STDIN.getc.ord.
– relet
2 days ago
@relet I am using tio.run
– MilkyWay90
2 days ago