Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Post History

33%
+0 −2
Meta Default Rules: Code Golf I/O

A program may output a boolean value by using different amount of time or instructions till it returns. If a program needs to determine a boolean value, it may return in less than N second (or ins...

posted 1y ago by H_H‭  ·  edited 1y ago by H_H‭

Answer
#3: Post edited by user avatar H_H‭ · 2023-09-19T15:23:40Z (over 1 year ago)
  • ## A program may output a boolean value by using different amount of time or instructions till it returns.
  • If a program needs to determine a boolean value, it may loop for a long time when the value is `true` but exits in a short amount of time if the value is `false`, or vice versa. Alternatively a number of instructions can be used instead of time (useful when running on computers with very different performance)
  • The difference has to be large enough to be detectable without much effort. I would suggest there is a factor of at least 32 between `true` and `false`. The difference of infinite should be allowed (if it doesn't return after N second, kill it and consider the result as `true`).
  • ## A program may output a boolean value by using different amount of time or instructions till it returns.
  • If a program needs to determine a boolean value, it may return in less than N second (or instructions) when the value is `false` but take longer than N + ϵ second (or instructions) when the value is `true` or vice versa.
  • The difference (ϵ) has to be large enough to be detectable without much effort. I would suggest there is a factor of at least 16 between `true` and `false` (i.e. $ϵ > 15 \cdot N$) . A infinite ϵ should be allowed (if it doesn't return after N second, kill it and consider the result as `true`). The poster has to give an estimate of N.
#2: Post edited by user avatar H_H‭ · 2023-09-19T15:11:42Z (over 1 year ago)
  • ## A program may output a boolean value by halting or looping forever.
  • I am not so sure about it, since you can't detect that for arbitrary programs, but i suggest it anyway.
  • If a program needs to determine a boolean value, it may loop forever when the value is true but exits if the value is false, or vice versa.
  • If there is a runtime limit on the challenge, then a program that didn't exit till the time runs out is considered non-halting.
  • ## A program may output a boolean value by using different amount of time or instructions till it returns.
  • If a program needs to determine a boolean value, it may loop for a long time when the value is `true` but exits in a short amount of time if the value is `false`, or vice versa. Alternatively a number of instructions can be used instead of time (useful when running on computers with very different performance)
  • The difference has to be large enough to be detectable without much effort. I would suggest there is a factor of at least 32 between `true` and `false`. The difference of infinite should be allowed (if it doesn't return after N second, kill it and consider the result as `true`).
#1: Initial revision by user avatar H_H‭ · 2023-09-12T13:12:16Z (over 1 year ago)
## A program may output a boolean value by halting or looping forever.

I am not so sure about it, since you can't detect that for arbitrary programs, but i suggest it anyway.

If a program needs to determine a boolean value, it may loop forever when the value is true but exits if the value is false, or vice versa.

If there is a runtime limit on the challenge, then a program that didn't exit till the time runs out is considered non-halting.