class TypeUnion: pass
def super_serious(obj): # super() is stupid and doesn't find magic methods
class t: pass
proxy = t()
for superclass in type(obj).mro()[:0:-1]:
for name, val in vars(superclass).items():
if not callable(val) or type(val) is type: continue
try: setattr(t, name, lambda _, *x, **y: val)
except AttributeError: pass
return proxy
print(super_serious(TypeUnion()).x)
Can you help me in golf rules? I'm unfamiliar with the rules you apply here.
In codegolf.stackexchange.com/q/121056/6691 , if I have a solution that outputs the right output to stdout, but also outputs some warning to stderr that you have to ignore, does that qualify?
class TypeUnion: pass
class t: pass
def super_serious(obj):
proxy = t()
for name, val in vars(object).items():
if not callable(val) or type(val) is type: continue
try: setattr(t, name, lambda _, *x, **y: val)
except AttributeError: pass
return proxy
print(sup...
Background
The tabs versus spaces war in programming has been going on a long time, basically because spaces are too low-level to have all the properties you'd want for alignment and indentation, but tabs can't be relied upon to work in all contexts (with some programs optimizing the use of tabs...
A demonic number is a positive integer whose decimal representation consists of only 6. The list of demonic numbers starts with 6, 66, 666, 6666.
Given a positive integer, output the nearest demonic number. If there are two, output the bigger one.
Testcases:
n output
1 6
2 6
3 6
6 6
...
One part of the code must identify another part of it? Is this type of thing allowed? The encoder is also the decoder, it just depends on how you run it
@Phoenix We also have a Quine that reads its own source. I don't think the standards apply to the actual Quine question.
The basic definition of a quine is a program that, when run, produces its own source code as output. There are a number of techniques and a number of way to implement those techniques across a number of different languages.
However, not all quine programs are equal. Clearly, any quine in HQ9+ or...
Answering in non-programming languages is allowed
The best challenges are written in terms of input and output. We avoid Do X without Y challenges because the Y is usually not defined in terms of input/output.
Disallowing non-programming languages is like disallowing arbitrary classes of langu...
The loopholes answer doesn't have enough votes to be valid anyway
Currently on the defaults for IO this answer is does not have enough positive votes to be instated. At press time it has +11-6, defaults are required to have:
5 net votes and at least twice as many upvotes as downvotes.
However only a day ago this method was valid (If memory serves it was ...
and judging by the fact I had to explain it not a very good one
Ok my phone is charged, so I'm going to go. If no one has posted a meta question by tomorrow I'll be more than happy to get a question towards socratic. :p
One thing before I go to sleep, Whoever writes the meta question should try to be as general as possible, there are other old questions just like the quine question that are out dated. If we could get a consensus on all questions instead of just that one that would do good.
@Arjun I don't think so.
Ok now I'm going to sleep for real. I need to wake up in ~3 hours.
Don't break the bridges!
Introduction:
You are a worker, who is in charge of managing a set of bridges, connecting a square grid of "nodes":
N - N - N
| | |
N - N - N
| | |
N - N - N
(the grid here is 3 by 3, but they can be larger).
Each of the bridges has a set capacity from 1 to ...
The Task
In this challenge, your task is to write a program which takes in no input and whose each anagram (or permutation) outputs itself.
Standard Loopholes and rules of standard quines apply.
Note: Your program must have at least 3 characters.
Input
Each anagram (or permutation) of you...
Golf you a quine for great good! is a great example, since it was posted before the quine consensus was made. That means it's cluttered with answers not following it. Should we repost challenges containing a lot of answers affected by a consensus change?
Do you ever look at 3D shapes and think that we have 2 many dimensions. So let's make 3D into 1D! (See what I did there?)
Task
Given a 2D representation of a cube (layout below), flatten it into a single string, based on pointers.
The CUBE
This is the layout of the cube filled with no-ops (,)...
Sum my Fibonacci divisors!
The famous Fibonacci sequence is F(0) = 0; F(1) = 1; F(N+1) = F(N) + F(N-1)
Your challenge is, given n, to output the sum the Fibonacci numbers index at index d for every divisor d of F(n).
Input: a positive integer n
Output: the sum of the Fibonacci elements of its...
Sometimes, I have lists of constant matrices in my code:
[ [[1, 0],
[0, 1]],
[[1, 0],
[0,-1]],
[[0, 1],
[1, 0]],
[[0,-1],
[1, 0]] ]
That's a terrible use of screen real estate. I'd much rather write them next to each other:
[ [[1, 0], [[1, 0], [[0, 1], [[0,-1],...
Glypho, 74 + (74 - 36) = 112
1. Run (74 bytes)
!!#%QTQT@=A@$!!$)()*!&))+...1449:@HILOQZ\\^`````````eefmpx|||{~~~~~~y~|~ ~
2. IO (36 bytes)
!!!#!$!$4419TAHT\ee\OQQQ))*+)..)|~~~
Explanation
Glypho seemed like a fairly good choice for this challenge, because it doesn't care about the actual ...
@Qwerp-Derp what I would probably do is to put a 1 at the bottom of the stack. then have two copies of the input on top, and then loop, incrementing one and decrementing the other, while swapping the sign of that 1 at the bottom until one of the two input copies is zero