Add++, the Language of the Month, has the "collect" builtin as BC. Your task is to implement this builtin.
Consider a non-empty array, where each element is either:
A positive digit between 1 and 9 inclusive, or
A non-empty list of positive digits between 1 and 9
For example, all the following...
we can search out for: 1. funniest comment 2. the most out of context 3. the best informational comment 4. the best event(do not need to be a announced one, for example cat week counts as event)
Background
A classical logic gate is an idealized electronic device implementing a Boolean function, i.e. one that takes a certain number of Boolean inputs and outputs a Boolean. We only consider two-input logic gates in this challenge.
There are \$2^{2 \times 2} = 16\$ distinct two-input logic g...
@RedwolfPrograms I'm lucky the course on software development I took at high school actually covered the software development cycle - despite the fact that it was based on info from the early 2000s, it still had actually helpful content
Heh, it even looked at lexing and parsing languages
Domino tilings in an N-dimensional cube code-golf dominoes tiling sequence combinatorics
Challenge
Imagine an N-dimensional cube which has dimensions 2×2×...×2. Given the value of N (a positive integer), calculate the number of ways it can be divided into 2×1×1×...×1 "hyper-domino" pieces (two un...
you just pick 256 characters and say your language's code is encoded in that codepage, and as long as you stick to only those characters you can call each one a byte
technically speaking your implementation does need to have a way to accept a sequence of raw bytes of the length you say it is in order for you to claim your answer has that length
for example, jelly has a flag that allows you to enter a file that's just raw bytes, rather than being in utf-8-encoded jelly codepage characters
0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
by definition, technically that is the case. i don't think we've really ever cared to check but because of the implementation-defines-language definition, you would need to be able to accept a string of that many bytes to claim your code has that many bytes
Best new programming languages
New programming languages sometimes is useful, But the answer gets more golfy and gets accepted, Even if it's new language.
@RedwolfPrograms How to properly use comments. Take a look at my github, I never use comments, because I was taught to basically comment everything, regardless of what it did. The way schools teach commenting now misses the point of comments
i personally stand by the opinion that most of your code should be written in a way that allows someone (who is reasonably familiar with the language and any frameworks, at least) to understand (approximately) what it does just by reading the code itself, and hence does not need commenting
ofc some larger things could do with some comments to explain some high-level things, and documentation is important
I have decided to create a discount Pokemon battle simulator using a module called guizero. It's basically a wrapper for Tkinter that is easier to learn. Recently, I started to learn OOP and thought that this project would be a good practice for my "new-found skills". Someone in my computing grou...
> This, like many of your comments, is exactly the kind of comment you should never write. It just says what the code does. We can see what the code does. Use comments, where absolutely necessary, to explain why it does it.
@hyper-neutrino Also when I manually format stuff I get paralyzed by all the choices. When an autoformatter does it for me, even if it isn’t perfect, I can shrug my shoulders and say “welp the bot said it gud so it gud” instead of spending an hour figuring out where to put a line break
and on top of starting to care a lot more about code efficiency and avoiding code repetition lately (because those two have started to really bother me when i don't care about them) my code is actually fairly reasonable quality these days :P
at least compared to before, which I suppose is a low bar
@hyper-neutrino My main motivation for clean code for Add++ v6 is that the current version of Add++ is buggy as fuck, inconsistent in it's builtins, so on and so forth, and I figured that a clean interpreter would lead to a clean language
yeah my main reason is that previously finding bugs took me forever cuz i'd have to dig through like 200 lines of code and it's impossible to tell where each stage of the algorithm starts and ends :P
@PyGamer0 It runs like "I need to print an array, so print [; now I need to print the first number, so let's evaluate it... oh, it has a print in it, let's print it; now I have the first number so I can print it now; ..."
I remember watching one of the Die Hard movies, idr exactly what happened but it was bearable despite having a weak plot
CMP: What are some movies that are so bad they’re good? The kind where you spend the movie laughing at how bad it is rather than enjoying the movie itself?
i'm having a ton of trouble giving a <table> a background color and padding it on the sides properly. are tables deprecated/gone as well or am I just bad?
I also dislike the fact that too many people equate disliking the sequels with disliking female lead roles. Cause Daisy Ridley is fucking amazing , but the writing is for shit
Too many people just can't understand that writers can be bad, and , no matter what the actors do, there's no salvaging a movie with a badly written script
I've had an idea for an esolang for a while, but I don't care enough to implement it: There's no looping, only conditionals, and once the last instruction in the program finishes you wrap around to the start.
> Sidex doesn't have any control flow other than an implicitly-wrapped infinite loop; instead, the only form of sequential control flow isn't sequential; they might execute at any order. As a complement, the whole program is wrapped in an infinite loop.
@RedwolfPrograms i think it has some facility for self-modification but last time i looked it still wasn't adequate for anything resembling conditionals
if not s:
i: (i || []) + input()
if tail(i) == -1:
i: slice(i, 0, -1)
s: 1
if s == 2:
if not size(i):
stop
print tail(i)
i: slice(i, 0, -1)
if s == 1:
s: 2
[implicit return to start]
Obviously the syntax would be much more esolang-y than this
But this is a program to print all inputs in reverse
It uses a state variable s to keep track of whether it's inputting or printing, since you can't nest loops
I haven't 3d printed stuff in a while...any ideas?
3d printed lego bricks don't actually seem like they'd work too well, thinking about the structure. I know people make them, so I guess they must either modify them quite a bit or spend a lot of time removing supports
Universal Command Sequence
Definition
An \$n\$-maze is a \$n\times n\$ chessboard which has "walls" on some edges, and a "king" on the board that can move to the 4 adjacent cells, which cannot pass through any walls. Starting from any cell the king should be able to reach every cell on the board....
I was solving this problem, and was looking at a solution after multiple failed attempts. I understand everything that the code does, but I don't understand why. Reproduced here:
string maxValue(string n, int x) {
int len = n.size() - 1;
int ans = len + 1;
if(n[0] == '-') {
...
Good news: I found out how to do type checking in Charcoal. Adding a list to an unknown type always results in a list, and in particular adding an empty list only results in the original unknown if it's a list. Similarly, adding a string to a number results in a string, so adding an empty string to an unknown only results in the original unknown if it's a string. Bad news: I'm pretty sure that there was an old challenge that required type checking on the input, but I don't know how to find it.