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 »

Activity for Razetime‭

Type On... Excerpt Status Date
Answer A: Plain black webpage
HTML, 16 bytes ``` ``` an attribute that works well for this challenge. tested on Mozilla Firefox. -3 from `[Object object]`
(more)
3 months ago
Answer A: Is it a valid hidden word?
Ruby, 128 bytes ```ruby ->x,y{g=->c{c.chars.join" ?"} !x[y]&&(x.match?(/.+#{g[y]}.+/)||(0...(y.size-1)).any?{x[/^#{g[y[0..1]]}.+#{g[y[(1+1)..]]}$/]})} ``` Attempt This Online! bookends are found with a constructed regex that takes most of the bytes.
(more)
5 months ago
Answer A: Build a replacement ball in regex.
Ruby, 82 bytes ```ruby ->w,n{[0...w.size].permutation(n).map{e=w1;1.map{|x|e[x]='.'};e}.uniq.join '|'} ```` Attempt This Online! uses `permutation` to do most of the work. Might be shorter with something recursive, maybe.
(more)
10 months ago
Answer A: Encode with ROT13.5
Stax, 15 bytes ⌐♪aù¢φσX▀┼╜°«↕j Run and debug it
(more)
over 1 year ago
Answer A: Knight safe squares
APL(Dyalog Unicode), 64 bytes SBCS ``` {64-≢∪x,u/⍨∧/¨(>∘0∧<∘9)u←⊃,/(a/⍨2|+/¨|a←,∘.,⍨1 2,-1 2)∘+∘⊂¨x←⍸⍵} ``` Try it on APLgolf! A dfn which takes a boolean grid.
(more)
over 1 year ago
Answer A: Lowercase, but not just the letters
APL (Dyalog APL), 42 bytes ```apl {⎕UCS⊢2⊥1@2⊢(7⍴2)⊤⎕UCS⍵} ```` Attempt This Online! In APL, base encoding(`⊤`) returns a matrix, so setting the lowercase bit is very easy with `1@2`, setting the entire second row to 1.
(more)
over 1 year ago
Answer A: Mediocre pop count
APL (Dyalog APL), 61 bytes ``` {⍵/⍨(⊢∊⌊/,⌈/)+⌿0 1↓2⊥⍣¯1⊢0,⎕UCS⍵} ```` Attempt This Online! APL's style of filter works very well here, since we can check for the max and min elements here: ``` (⊢∊⌊/,⌈/) ``` and filter using the boolean mask later: ``` ⍵/⍨ ```
(more)
over 1 year ago
Answer A: The holeyest base
Ruby, 77 bytes -&gt;x{(2..16).maxby{x.tos(1).chars.sum{|y|"&#1;&#1;&#1;&#2;&#1;&#1;&#2;&#1;".bytes[y.hex]}}} Attempt This Online!
(more)
over 1 year ago
Question Mark my beacons
Given a grid of numbers, mark the concentric areas around nonzero elements (beacons) decreasing from the value of the beacon till 1. For example, here are some grids with a single beacon: Size 1: ``` 0 0 0 0 0 0 0 1 0 -> 0 1 0 0 0 0 0 0 0 ``` Size 2: ``` 0 0 0 1 1 1 0 2 0 -> 1...
(more)
over 1 year ago
Article Mark my beacons
Given a grid of numbers, mark the concentric areas around nonzero elements (beacons) decreasing from the value of the beacon till 1. For example, here are some grids with a single beacon: Size 1: ``` 0 0 0 0 0 0 0 1 0 -> 0 1 0 0 0 0 0 0 0 ``` Size 2: ``` 0 0 0 1 1 1 0 2 0 -> 1...
(more)
over 1 year ago
Question Find n Niven Numbers
Challenge A Niven number is a positive integer which is divisible by the sum of its digits. For example, `81 -> 8+1=9 -> 81%9=0`. Your task is to find the first `n` Niven numbers, given `n`. Tests Reference implementation(takes input) first 16 values: ``` 0 => 1 1 => 2 2 => 3 3 =...
(more)
over 1 year ago
Question Make a frequency table (histogram)
Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency table as a list of pairs, hashmap/dictionary, output the pairs directly, etc. Tests ``` { 1 1 2...
(more)
almost 2 years ago
Article Make a frequency table (histogram)
Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency table as a list of pairs, hashmap/dictionary, output the pairs directly, etc. Tests ``` { 1 1 2...
(more)
almost 2 years ago
Answer A: Does Looping Counter qualify as kolmogorov-complexity?
No Your logic is correct. kolmogorov-complexity requires for the same constant fixed output across all solutions. This is not a static pattern, since it runs forever, so it doesn't fall under that umbrella. Allowing for a flexible character wouldn't really disqualify a question from kolmogorov co...
(more)
almost 2 years ago
Answer A: Rules for function submissions
General requirements You need to have all the code that is necessary to create the function within your submission. For most languages, this may include the syntax for defining the name and argument list of the function, and delimiters for the function body. Some languages have first class fun...
(more)
almost 2 years ago
Question Rules for function submissions
What are our rules for function submission? What constitutes a function, and what makes a submission valid? Language agnostic answers are allowed.
(more)
almost 2 years ago
Question Create a range grid
This challenge is based on the `i.` verb from J. A range grid is basically a range of `m × n` numbers fit into a rectangular grid with `m` rows and `n` columns. A `2×3` range grid would be: ``` 0 1 2 3 4 5 ``` Challenge Generate a range grid, given `m` and `n`. You can display it, ...
(more)
almost 2 years ago
Article Create a range grid
A range grid is basically a range of `m × n` numbers fit into a rectangular grid with `m` rows and `n` columns. A `2×3` range grid would be: ``` 0 1 2 3 4 5 ``` Challenge Generate a range grid, given `m` and `n`. You can display it, or return an array. This is `code-golf`. Shortest ...
(more)
almost 2 years ago
Answer A: Looping counter
Haskell, 35 bytes main=mapM putStrLn$iterate(&#39;&#39;:)&quot;&quot; Attempt This Online! 55 -> 39, with orthoplex's idea. 39 -> 35 from orthoplex.
(more)
almost 2 years ago
Answer A: Keyword golfing
BQN, 107 bytes ``` A↩C←A⇐¯π{𝕣:@;/⊏𝕩.y?𝕗‿∊𝕊⟨𝕤,⍷⟩𝕏𝕎𝔽𝕨𝔾𝕘}∞˙⌜˘¨´˝`(•Js⎉⊔⎊⌽⌾⍉⚇«∘»·∧○∨⍋⍒↑↓≍∾˜⥊⋈↕⊢⍟⊣¬!|≡≢/≥⟜≠=⊸≥⊐⊘⊒◶⊑><⌊⌈√⁼⋆+-×÷)⋄# ``` BQN doesn't have keywords but primitive symbols are reserved. It's quite funny how this manages to compile.
(more)
about 2 years ago
Question Can you give me half?
Challenge idea taken from: Eliseo D'Annunzio Task Provide code that evaluates to 0.5 numerically, i.e. the output must be recognized by your chosen language as a numeric value (Number, float, double, etc), not as a string. The catch, the characters 0 through to 9 cannot be used. One examp...
(more)
about 2 years ago
Article Compute T-shirt size
WIP. You will be given an ascii-art T shirt. ``` / \/ \ |/| |\| || ``` this is the basic structure. the challenge will be about getting the size as a string (XS, S, M, L, XL, XXL)
(more)
about 2 years ago
Answer A: Determine whether an integer is square-free
BQN, 13 bytesSBCS ```none ∧´0≠⊢|˜·×˜2+↕ ``` Run online! A train submission. It's 2 bytes shorter than the lambda version `{∧´0≠𝕩|˜×˜2+↕𝕩}`, due to omitting curly braces. The idea is similar to ruby: - range 2..n+1 - square it, then modulo n - are all remainders ≠ 0?
(more)
over 2 years ago
Answer A: How can we grow this community?
Questions The most important thing to gain traffic in a code golf site is having good questions. SE code golf has 12,718 questions(and counting), and many people are still actively posting questions in there, so it gets a sizeable amount of traffic for answers. Good questions get more votes since co...
(more)
over 2 years ago
Question Find the IP address class
Task Given an IP address as a string, find its IP address class. For reference, here is a table: Class Leadingbits Numberof networks Addressesper network Total addressesin class Start address End address Class A 0 128 (27) 16,777,216 (224) 2,147,483,648 (231) 0.0.0.0 ...
(more)
over 2 years ago
Article Find the IP address class [FINALIZED]
Task Given an IP address as a string, find its IP address class. For reference, here is a table: Class Leadingbits Numberof networks Addressesper network Total addressesin class Start address End address Class A 0 128 (27) 16,777,216 (224) 2,147,483,648 (231) 0.0.0.0 ...
(more)
over 2 years ago
Question The Ludic Numbers
The Ludic Numbers are a sequence that pops up when you apply the sieve of eratosthenes to the natural numbers, completely removing the numbers every iteration. Here is how they are generated: The Ludic numbers start with the lists: ``` l = [1] n = [2,3,4,5,6,7,8,9,10....] ``` Every itera...
(more)
over 2 years ago
Article The Ludic Numbers[FINALIZED]
The Ludic Numbers are a sequence that pops up when you apply the sieve of eratosthenes to the natural numbers, completely removing the numbers every iteration. Here is how they are generated: The Ludic numbers start with the lists: ``` l = [1] n = [2,3,4,5,6,7,8,9,10....] ``` Every itera...
(more)
over 2 years ago
Answer A: Collatz conjecture; Count the tries to reach $1$
[BQN], 31 28 bytes {1+(1≠𝕩)◶¯1‿𝕊2(|⊑÷˜∾1+3×⊢)𝕩} Try it online! An anonymous function which takes a number. the `¯1` branch is a bit tacky but saves a byte over `(1+𝕊)`.
(more)
over 2 years ago
Answer A: Digit Sum Integer Sequence (working title)
[jq], 38 bytes while(1;.+("\(.)"|explode|max+min-96)) Try it online! prints the infinite sequence starting with \$n\$.
(more)
over 2 years ago
Answer A: Stairs? Stairs! Stairs.
Stax, 8 bytes Ç▐GcΦ≡◘¶ Run and debug it Uses spaces as the staircase fill.
(more)
over 2 years ago
Answer A: My house is destroyed! Can you make me one?
[Charcoal], 7 bytes GH↑→↓N# Try it online! Link is to verbose version of code. `PolygonHollow` exactly fits this challenge. > Prints a polygon with sides in x, all with length y, and the z used for the sides, repeating from the origin. Polygon is not autoclosed or filled.
(more)
over 2 years ago
Question When The Ternary Is Balance
Inspired by this Rosetta Code article. Introduction Balanced Ternary is a method of representing integers using -1, 0 and 1 in base 3. Decimal 11 = (1 32) + (1 31) + (−1 30) = [1,1,-1] or "++-" Decimal 6 = (1 32) + (−1 31) + (0 30) = [1,-1,0] or "+-0" Task Given any integer, y...
(more)
over 2 years ago
Answer A: "Hello, {name}!"
[jq], 14 bytes "Hello, \(.)!" Try it online! jq has expression interpolation, pretty epic!
(more)
over 2 years ago
Answer A: Make my value binary
[jq], 48 bytes [while(.>0;./2|floor)]|map(.%2)|reverse|join("") Try it online! jq is the Language of the month for September! if the output is not required as per the question, `join` can be omitted.
(more)
over 2 years ago
Article Balance my ternary[FINALIZED]
Inspired by this Rosetta Code article. Introduction Balanced Ternary is a method of representing integers using -1, 0 and 1 in base 3. Decimal 11 = (1 32) + (1 31) + (−1 30) = [1,1,-1] or "++-" Decimal 6 = (1 32) + (−1 31) + (0 30) = [1,-1,0] or "+-0" Task Given any integer, y...
(more)
over 2 years ago
Answer A: Make $2 + 2 = 5$
[Husk], 7 bytes +±Λ=2¹Σ Try it online! Input as a list.
(more)
over 2 years ago
Answer A: Getting perfect squares, differently
[Husk], 3 bytes ∫İ1 Try it online! Scan from left over all odd numbers with addition. Uses this formula: $$ n^2 = \sum{k=1}^n(2k-1) $$
(more)
over 2 years ago
Question Are All Elements Equal?
Challenge Given a list of integers >= 0 , check if all of them are equal. Tests ``` [1,1,1,1,1] -> true [0,1,1,6,7] -> false [1] -> true [] -> undefined(you do not need to handle this) ``` You may take the integers in any form(strings, list, codepoints, etc.) Yo...
(more)
over 2 years ago
Answer A: Reduce over the range [1..n]
BQN, 8 bytes ``` {𝔽´1+↕𝕩} ``` Try it! basic fold builtin version. Use as a dyadic 1-modifier. Longer than APL since evaluated output is shorter than using first class functions. A more fun recursive implementation without fold: ``` {1𝔽{(𝕨𝔽⊑𝕩)(1A previous(wrong) version of this expo...
(more)
over 2 years ago
Answer A: Should [code-golf-tips] be replaced with [tips] + [code-golf]?
Yes tips is a sort of prefix tag, and code-golf-tips is a superfluous tag. I think it it worth keeping them separate because tips is already very flexible.
(more)
over 2 years ago
Answer A: It's Hip to be Square
[Husk], 5 bytes ±£Θİ□ Try it online! similar to haskell, checks if the number is in the infinite list of squares.
(more)
over 2 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Lundin's answer: [C++ (gcc)] %: %: define cops(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) if(not false and k%:%:f%:%:d%:%:l(& (not true) )) %: main() Try it online!
(more)
over 2 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Shaggy's answer: Japt ((Cops)&(Robbers))`¬ps „d žbÞ`¸ËhDÎmEgviuø Test it
(more)
over 2 years ago
Article Are All Elements Equal?[FINALIZED]
Challenge Given a list of integers >= 0 , check if all of them are equal. Tests ``` [1,1,1,1,1] -> true [0,1,1,6,7] -> false [1] -> true [] -> undefined(you do not need to handle this) ``` You may take the integers in any form(strings, list, codepoints, etc.) Yo...
(more)
over 2 years ago
Answer A: Answering challenges with languages newer than the challenge
Languages made specifically for a challenge after it was published This is the general problem with allowing languages newer than the challenge. This is already considered a standard loophole, and the `might be downvoted anyway...` point will apply. Some questions heavily benefit from this(cops...
(more)
over 2 years ago
Question Gamer Meme Creator
Challenge You will be given a string and an ascii art as input. - The string must be placed above the ascii art, and centered based on its longest line. - The text `BOTTOM TEXT` must be placed below the art and centered based on the ascii art's longest line. The centering can be biased toward...
(more)
over 2 years ago
Article Gamer Meme Creator[FINALIZED]
Challenge You will be given a string and an ascii art as input. - The string must be placed above the ascii art, and centered based on its longest line. - The text `BOTTOM TEXT` must be placed below the art and centered based on the ascii art's longest line. The centering can be biased toward...
(more)
over 2 years ago
Answer A: Caesar shift cipher
[Ruby], 56 bytes ->s,i{a=[?a..?z].rotate(i)"";s.tr "A-Za-z",a.upcase+a} Try it online! `tr` is wildly useful here. Builds the tr string manually and replaces only the alphabets.
(more)
over 2 years ago
Answer A: How free is "free" for cops and robbers?
Free as in usable on a free platform "free" meaning there must be a downloadable interpreter available for the language which can run the program with the required features, on an online/offline service with no software limitations(time, number of executions, etc).
(more)
over 2 years ago