Base Guard
base-conversioncode-golfnumber
Base: part 1
This is part 2, Strongly suggest you go try out the first one if you haven't tried it.
Story
As one of the solvers, You've managed to get to the door of the base heaven. In front of the door stands the base guard @Lyxal, Holding a bunch of ti...
requiring base digits instead of allowing output as a list of digits as numbers is one of those requirements that's just annoying I/O, not actually an additional challenge, and thus this becomes exactly a duplicate
Introduction
In this challenge, I asked you to implement swap encoding.
Swap encoding is an encoding method where you iterate through the string, reversing substrings between identical characters. The basic algorithm is:
For each character in the string:
Check: Does the string contain the charact...
Create the smallest possible fork bomb (creating an exponentially increasing number of objects that allocate memory and create more instances of the same object, such as the well known :(){:|:&};: in BASH) for a language.
The program must be able to be terminated by pressing any key; this does no...
import java.util.*;
public class Main {
public static void main(String[] args) {
Integer[] a = new Integer[] {1, 2, 3, 4, 5};
System.out.println(Arrays.asList(a).contains(3));
}
}
@Lyxal generics can't take ints so int... can't be used
You are given 3 numbers: x, y and z, you have to minimize the number of digit(positive) inserted at any place to the numbers x,y,z to make
$$x + y = z$$
(you can assume x,y,z and your final integers after insertion be such that they won't overflow integer limit in your language)
Example:
x=1 , y=...
also, C and C++ are alright languages :3 tho, i would argue that C++ is one of the hardest languages to learn and C is one of the most verbose languages
Hi guys, this isn't to do with golfing, but as a JS dev should I learn Typescript or C#? I dislike dynamic typing because I find myself abusing it too often and I worry that I might make a mistake
rust is way less intimidating than C++. If Rust sees something suspicious, it speaks up. If C++ sees anything it doesn't like, it sets your computer on fire.
values that need deallocatin logic get deallocated automatically at the end of their scope. Compiler also statically checks there aren't any references pointing to them that would now point into the void.
for example, String is a type responsible for de/allocating a buffer with utf-8 data inside. &str is a type that points to some block of utf-8 data (not necessarily the entire buffer) that somebody else is responsible for deleting.
Protip: Whenever you feel like learning a new general-purpose programming language, check out codewars.com, solve some easy problems, and learn more by reading top solutions, repeat by solving more problems.
5
You get the necessary basics real quick
In the case of Rust, the official introductory material is also good
and Rust actually feels like a high-level language 90% of the time despite it being a compiled language without GC
part of it is because if you have a generic function it produces one version for it for every type you use. There's a compiler flag to make it output code that's as small as possible instead of as fast as possible though.
unfortunately all reasoning about the utility and quality of programming languages becomes useless when your customer/employer says "i want technology ${x} for my project" :)
I'm probably not going to be in TNB for the next six hours or so, I've got a big test and need to do a bit of practice without being distracted by code golf :p
there are a couple of people who want the new KoTH reopened so I'd like to discuss it. CMM i guess
the thing is, yes, there are some new strategies here you could try, and some old strategies from the xkcd you can't. but IMO it's still just about generating an appropriately large but not too large number with a slightly different score distribution
even if the old challenge were more continuous and the new challenge has the discrete jump from earning double to losing points if you get blown up, i don't think that adds much more of a skill ceiling
and the main issue is that these two back-to-back may set a bad precedent for KoTH as some people have pointed out, especially with how xkcd drew in so many new users
I don't know about our official duplicate policy (which I think is rather flawed anyway), but I don't think it offers anything particularly new and interesting. It is a slight twist on an already very simple challenge.
If there are two questions on a typical Q&A site, "how do I call a function" and "which function do I use for cosine", you'd still close "how do I find the cosine of a number using the Math object" as a dupe of at least one of those
Create a bot to choose the smallest unique number.
(Based on a psychology experiment I heard about many years ago but haven't been able to track down again.)
Rules
Each game will consist of 10 randomly selected bots playing 1000 rounds.
Each round, all bots select an integer from 1 to 10 (inc...
Close voters: things that were unclear were fixed. Otherwise you really should comment them instead of just close voting, esp. on a new account. codegolf.stackexchange.com/questions/225042/…
@xash that is completely wrong. If a question is unclear and close-worthy it should be closed. Welcoming new users is important but that doesn't exempt them from how our site operates
if you leave a challenge open, people will answer it, and the more answers a challenge gets while not fully clarified, the worse the problem gets
I didn't get around to reviewing this challenge before it got closed; if it was clear then that's an entirely different issue but whether or not the user is new doesn't really factor into that IMO.
Anyway, thanks for reopening it; I just got back to my computer.
@hyper-neutrino Yeah, the question wasn't unclear or close-worthy. Otherwise of course. The "esp. on a new account" wasn't my main massage, just that I'd find it irritating as a new community member.
Imagine knowing how parsers work and not just stringing together endless horrible for loops and recursive functions and hoping you never have to update anything
you can change your name faster in chat by using different usernames on different communities which is probably allowed cuz a lot of people have done that and nobody's ever cared
Perhaps replacing System.out.println with something that only accepts a B might change it
Looks like the bytecode kinda removes the assignment to x and just does return new C(), so maybe that's causing it
Wait, it doesn't remove the assignment, but it looks like it doesn't store information about x's type either?
@user So I defined a function void foo(B b) and doing foo(x) did error, but not System.out.println. No idea why a local's type isn't checked but a method's parameters' are
Can we at least select our fonts?
status-completed Check out the resolution to this question: Fonts and the new Q&A theming
I think the fonts give much of the feeling to a site, and may even affect usability. For instance, English.SE benefits from using a serif font to clearly distinguish lette...
As you consider the font stack, please do consider revisiting this very popular request. Yes, it is marked status-completed, but "New plan is the old plan, mostly" and these fonts are still inappropriate for a significant number of sites.
Unfortunately, a site cannot detect which fonts you have installed (without Flash…). Otherwise it'd be simple to provide a drop-down to select your font.