Black and White Rainbows
code-golf image-processing graphical-output
Given an image that has only black and white pixels and an (x,y) location that's a white pixel, color the white pixels based on their minimal Manhattan distance from (x,y) in a path that only involves traversing other white pi...
A Lab color space is a color-opponent space with dimension L for lightness and a and b for the color-opponent dimensions, based on nonlinearly compressed (e.g. CIE XYZ color space) coordinates. The terminology originates from the three dimensions of the Hunter 1948 color space, which are L, a, and b. However, Lab is now more often used as an informal abbreviation for the L-a-b representation of the CIE 1976 color space (or CIELAB, described below). The difference between the original Hunter and CIE color coordinates is that the CIE coordinates are based on a cube root transformation of the color...
1. Have a starting pixel. 2. Flood fill from that pixel. 3. For each reached pixel, take half-unit steps between that pixel and the start, following a straight line. 4. For each half step, `int()` their coordinates. 5. If the pixel at this coordinate is black, stop. Otherwise, continue.
one time i played someone on netplay who kept changing characters after every couple of games. when we were done they told me i was "boring af" to play against because i only play captain falcon. i'm bad at falcon but they were garbage at like 5 different characters :P
"The Chebyshev distance between two spaces on a chess board gives the minimum number of moves a king requires to move between them." i want to see a distance defined by the number of moves it takes a knight
it's not that i'm surprised that there's overlap between people who care about programming and people who care about chess i'm just surprised that the overlap even wanted a wiki
I guess there's a lot of people who want to figure out how to make a program that can beat humans in chess. ... what's that? That's already been done? Well damn.
@Calvin'sHobbies: Do you think we should include Euclidean distance as a bonus or, perhaps, maybe, possibly, leave it for a separate code-challenge contest?
Euclidean, incidentally, is 327, but a significant chunk of that is making it so I can watch the color spread update instead of waiting forever for it to finish.
@Calvin'sHobbies Okay, I'll do that tomorrow. What times are you usually awake and alert?
The Game
You remember the classic game "Nine Men's Morris" or simply "Mill"? There's variation called Three Men's Morris which is a bit like a mutable tic-tac-toe.
Rules
This is the blank board of the game:
a b c
1 [ ]–[ ]–[ ]
| \ | / |
2 [ ]–[ ]–[ ]
| / | \ |
3 [ ]–[ ]–[ ]
[ ...
Grrr. My CS class has a time requirement for how long our code takes to execute and they don't even allow us to specify -O3 (in fact, the compile it without any optimization option). Rather annoying.
I found that g++ has #pragma gcc optimize(3) (something like that), although that only works for each individual cpp file. So I do get the improvement from 2m47s to 1m37s, although I don't get the improvement to 36s. So sad.
i saw someone who wrote C or C++ (i don't recall which) for a class they had to take but was way below their level. they decided to write code that worked but was as confusing as possible. their "hello world" didn't have any code in it, main was defined as an array of ints
@orlp You really don't need to be reading into this, but if you want to, this is the course wiki
Sometime I'm going to build an actual interpreter/compiler, for a real language, rather than this weird logic programming language. That will be a lot more fun than this.
Triangularity
This is a challenge where you have to work out the length of a given w and h.
To qualify as a correct solution:
The program uses STDIN to get the values of w and h.
The program uses STDOUT to output the value of a in the above diagram.
The shortest code in bytes wins.
Tags:...
Standalone Array Pop Function
Without using any native array functions, methods or properties create a standalone array pop function, that taking an array, providing there is at least one element, will pop the last element off that array, return that value, resulting in the original array being...
What time is it again?
popularity-contestdate-time
The challenge is simple: output the system type in any way you see fit. This includes using any standard loopholes or joke answers - whatever you want.
Rules (limited they may be):
The only standard loophole you cannot break is the new langu...
Feedback, anyone?
(keep in mind that this is supposed to be simple. Ish.)
If the challenge is "output the system time", there might be a dupe (not sure), but would be better as a golf either way. If it's "do something creative with time output", I think it's waaaaay too broad.
> This includes using any standard loopholes - whatever you want.
Mine uses hardcoding:
System.out.print("now");
It doesn't even have to loop or be re-ran to stay current. Just run it once and you can glance back at the output whenever you want to know what time it is.
I meant some sort of community gathering, though. Like an annual meetup of cyclists to have a race or something. I don't see how that would be a bad thing for them.
Sure, not everyone would be able to attend, but if you throw in a picnic/barbecue, it would be a bunch of fun.
Catalog Challenge: Write a program that outputs the lyrics to 99 Bottles of Beer, in the shortest amount of bytes.
Rules:
Your program must log to STDOUT or an acceptable alternative, if STDOUT is not available.
Your program must be a full, runnable program or function.
Unlike our usual rules,...
The only positive to the snippet I see is that it's collapsed/hidden by default instead of having a large code block there. Would probably leave as-is, but I don't feel strongly enough about it either way to approve/reject.
It'd be nice if there was some way to collapse content without snippetizing it though.
@phase I'm not sure about this. It isn't a snippet, but un-snippeting conflicts with the author's wishes. You could just wait for Pietu1998 to make the call.
in Javascript (any version) can you make this shorter?
var out = '':
if(y>0){
out='Y';
}else if(y<0){
out='^';
}
if(x>0){
out='>';
}else if(x<0){
out='<';
}
console.log(out)
Explanation:
x and y are given numbers representing a vector
output is a console.log of string with one or two ch...
The question title says more or less everything.
Write a program/function that outputs every 8-bit ASCII character not present in the code itself, onto a file (or the screen itself; I'm not sure if that is even possible for certain control characters).
Obviously, your code must be written in AS...