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 Moshi‭

Type On... Excerpt Status Date
Comment Post #289439 It's the same length `갠긂갠밂乘감뒄뀢감雙강밅剩`
(more)
9 months ago
Comment Post #287194 Both of these problems are solved by the `*`. See https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1q5Yr7ggJ7NEQz86LjE1M780Vks/U/N/cn5ecX5Oql5OfrpGmkYCWKYICMCMBE3N/wA
(more)
over 1 year ago
Comment Post #287194 [Splitting is shorter](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1q5Yr7ggJ7NEQz86LjE1M780Vks/U/N/cn5ecX5Oql5OfrpGmkZCok@Ja5FfYkhqgqbmfwA) ``` s=>s.split(/[^aeiou]*/i) ```
(more)
over 1 year ago
Comment Post #287132 Make that an answer and I'll upvote it ;)
(more)
over 1 year ago
Comment Post #287120 Done👍Someday I'll get around to updating the leaderboard script to fix issues like these
(more)
over 1 year ago
Comment Post #287131 > You may choose to take input with any 2 distinct characters representing a knight and an empty square Can I use a two-dimensional Boolean array? (I mean, I suppose technically for a given definition of a "character", I could use ascii codepoints 0 and 1....
(more)
over 1 year ago
Comment Post #287096 I mean here: https://software.codidact.com/
(more)
over 1 year ago
Comment Post #287096 You probably wanted to post on our Software site
(more)
over 1 year ago
Comment Post #282836 I'm very confused as to how that code even works but thanks lol.
(more)
over 1 year ago
Comment Post #287026 Note: Tag synonyms are also Coming Soon(TM) so multiple spellings will also be less of an issue then :)
(more)
over 1 year ago
Comment Post #286989 Could you include a test case with overlapping beacons?
(more)
over 1 year ago
Comment Post #286603 At least in C/C++ you can abuse preprocessor directives to just do ``` #ifdef A BCDEFGHIJKLMNOPQRSTUVWXYZ ``` Where you can more or less just extend it as far as you want (EDIT I messed up my directives but the theory should hold)
(more)
almost 2 years ago
Comment Post #286369 ```c f(i){return i>1?f(i%2?3*i+1:i/2)+1:0;} ``` - Returning is cheaper than an accumulator - Conditioning on not equal (in this case, >) saves one byte
(more)
almost 2 years ago
Comment Post #286394 I mean, you can say that about any infinite challenge. I suppose though that I could also require a proof that the programs solve the challenge.
(more)
almost 2 years ago
Comment Post #286394 > Does that mean using only the code section of some try-it-online tool? I don't really get what you mean by this. I was under the impression that anything runnable without needing to add anything counted as a full program. > Does that mean generting an executable/script file? Or only printing ...
(more)
almost 2 years ago
Comment Post #286370 ```lua function(x)return x==1 and 0 or 1+f(({x/2,3*x+1})[x%2+1])end ``` \- Directly returning the result is cheaper than passing an accumulator \- Indexing into an array is cheaper than an `and or`
(more)
about 2 years ago
Comment Post #286354 By default, [yes](https://codegolf.codidact.com/posts/282784/282787#answer-282787)
(more)
about 2 years ago
Comment Post #286301 If your function never runs, then clearly it won't have a runtime error :)
(more)
about 2 years ago
Comment Post #285479 39 bytes with ```python lambda n:all(n%i**2for i in range(2,n)) ```
(more)
over 2 years ago
Comment Post #284994 ```ruby ->p,s{s<2?"Hole in one":%w[Albatross Eagle Birdie Par Bogey Double Triple][s-p+3]+(s-p>1?" bogey":'')} ```
(more)
over 2 years ago
Comment Post #284952 ```C f(p,s){return(char*[8]){"Hole in one","Albatross","Eagle","Birdie","Par","Bogey","Double bogey","Triple bogey"}[--s?s+5-p:0];} ```
(more)
over 2 years ago
Comment Post #284852 > Par can be a value between 3 to 5 You won't ever get `6 2` if I'm reading it right.
(more)
over 2 years ago
Comment Post #283791 ```python from numpy.linalg import det ```
(more)
over 2 years ago
Comment Post #284611 https://tio.run/##XY1PS8QwEMXP6acYFlxS2w0i7MVuVvAgePC0R/UQ@4@JbVqS6dIg/ew1tYvCHuY93syPeVqd1U4XXzO2fWcJdMhiIGxENZicsDPiNov64bPBHPJGOQevCg18R@yydKQo2LnDAtpw4ieyaOq3D1C2dvFCsid8vnw7vBgq69KmV36ECiTMfEx9vDuOUvrt1kt5/7h/GBM/M5aFN1VngaMhwMDeZcEOsA@WJGvNP6BXQK@A/gPYyTsqW9ENJALcKuKbmwISCCKDvJtNCpiCTqESqu8bz5c...
(more)
over 2 years ago
Comment Post #284572 @#8056 This is why I should look things up more often orz
(more)
over 2 years ago
Comment Post #284522 ```python lambda a,b,c:[p for p in"+ - * // % **".split()if(p in'+-**'or b)and eval(f"{a}{p}{b}")==c] ```
(more)
over 2 years ago
Comment Post #284391 I'm curious why you reverted the LaTeX correction. Did you really mean to not put commas in the number?
(more)
over 2 years ago
Comment Post #284396 https://tio.run/##XZJfb4MgFMWf209xQ9JEtNvQdn9qh19k8aGxOEkcNnDb4ZZ99u4C68t4gMMv5xxRPM04TGZzvR5VD33meb1cOMnY/iDZl7ITTEYBfk6Ag1UK@ulsodcXBU57cOqiDCj9PiAYHYxhO0aKn2okGw7aoqJ9SCah@7hSQVqDPapYFEToioJKDM6pZKaKOFN@jun5Lzun5JxyM7t3p1FjxvcoSyHEvpOY43Khe/CN7Gon6T0fHjpeMPjQ46gnw/Z@JbubBWtXSAYsz1zDGC@iHYOdvtXZHcw...
(more)
over 2 years ago
Comment Post #284104 62 bytes: ``` for i in range(1,101):print("Fizz"*(i%3<1)+"Buzz"*(i%5<1)or i) ```
(more)
over 2 years ago
Comment Post #284396 https://tio.run/##RZLRTsMgFIav16c4kpiUdirtdGad7EVML7aOWpKOLnCqrcZnnwfYIhecw5///6CU84zdYFaXy1G10KYTr5KFk4xt95J9KzvAYBTg1wDYWaWgHUYLrf5U4PQETn0qA0p/dAhGe6Nf9kHFL9WTDTttUdHaJ2Oj21AJEKu3hy6AfONZvmGP7txrTPn2IBkBDc4ROBMuzMSaA2m@cuZImSNj/ic0shBZtt4iVSGShW5h2smmcpK@@ump4TmDk@57PRi2ne5lc7Ng5XLJgGWpu6OL4Xnwo/f...
(more)
over 2 years ago
Comment Post #284397 ``` {"vi": 20, "Emacs": 20} → [] ``` If I read the specification correctly, then shouldn't the correct coalition be `[["vi": 20, "Emacs": 20]]`?
(more)
over 2 years ago
Comment Post #284334 Use `[*range(2,n+1)]` instead of `list(range(2,n+1))`
(more)
over 2 years ago
Comment Post #284288 It's better just to use a for loop instead of an expensive `[...Array(n)].map((_,i)=>` ``` (n,i=n)=>{for(;i;)console.log((' '.repeat(i)+'_/'+'##'.repeat(n-i--)).slice(3))} ``` https://tio.run/##bctBCsIwEEDRfU8R6GJmqInQQDclnkSQEBOJhElJSjfi2SN2IQpu/@Pf7WarK3FZJeerb8E05EM0TOb0CLngHGdymWtOXqV8Qw...
(more)
over 2 years ago
Comment Post #284289 ```python lambda s,n:''.join((c,chr((ord(c)+n-(o:=65+(ord(c)>96)*32))%26+o))[c.isalpha()]for c in s) ``` https://tio.run/##XY3NTsMwEITvPMVyqOwlJlKTNoVK5QzPABwcp/4hxhttDA19@RAkDhTNYaT5PmmGr@wp1XcDz0z58DJH/d52GkaV9kKUbxSSlEYZz1ISd9JgkW4l7Q/NtvgdHu4bvKkrxFXVFIT4bMow6jh4LfHVEoOBkGDEeeCQslxupHg8xkgKT...
(more)
over 2 years ago
Comment Post #284145 It's cheaper to set x outside the loop ```python x=int(input()) for i in range(x+1):x-i*i or exit(1) ``` [51 bytes](https://tio.run/##K6gsycjPM7YoKPr/v8I2M69EIzOvoLREQ1OTKy2/SCFTITNPoSgxLz1Vo0LbUNOqQjdTK1MBKJFakVmiYaj5/78hAA)
(more)
over 2 years ago
Comment Post #283989 Can I return a number instead of a string for the zero case, even if I am using strings for the other return values?
(more)
over 2 years ago
Comment Post #283990 @#53588 That returns a number instead of a string for `f(0)` though, which I'm not sure whether it is allowed. I can implement the other part though for 49
(more)
over 2 years ago
Comment Post #284100 Instead of doing an indexed for loop, just iterate over the characters directly with `for c in x:`. [38 bytes](https://tio.run/##RYo5CoAwEABrfUXYKitbeFVKer@hOTAQkiAK5vXxKLScI6Z9Db7LWWnDDD8p4VAWJmxMMuvZOcTN@p1rr4SsEuYoXlEaDvMigRocI8cHJ@1cAKo/ocKxOA3U/osF6j@6S435Ag "Python 3 – Try It Online")
(more)
over 2 years ago
Comment Post #284040 See https://en.m.wikipedia.org/wiki/Collatz_conjecture
(more)
over 2 years ago
Comment Post #283990 @#8056 Fixed it
(more)
over 2 years ago
Comment Post #283982 You can use this trick with more than one statement by using semicolons. For example, this will work as well: ``` for x in range(4):print('a');print(x) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/Py2/SKFCITNPoSgxLz1Vw0TTqqAoM69EQz1RXdMawqzQ/P8fAA "Python 3 – Try It Online")
(more)
over 2 years ago
Comment Post #284000 ``` j,k;f(i){for(j=i;j--;printf("#"));for(j=i-1;j--;printf("#"))for(k=i-2,printf("\n#");k--;printf(" "));} ``` [Try it online!](https://tio.run/##S9ZNzknMS///P0sn2zpNI1OzOi2/SCPLNtM6S1fXuqAoM68kTUNJWUlT0xoqoWuIIQWSyQbKGOnARGPygOLW2UjqFEBG1P7PTczM09Cs5uJM0zDVtC4oLSkGKQaqBYmYY4gYGgDp2v8A "C (clang...
(more)
over 2 years ago
Comment Post #283865 @#8056 "On one hand, the wording is obviously misleading because that's not what it was referring to" What was it referring to then? I'm not sure what else it could mean.
(more)
over 2 years ago
Comment Post #283865 If I am understanding these points correctly, > The tens-/ones part, if not zero, must be separated with and, e.g. two hundred and five, not two hundred five. > > The above rules are applied also to the factors of thousand and million. Then 1,000,001 should be "one million **and** one"; howev...
(more)
over 2 years ago
Comment Post #283978 https://tio.run/##JclLCoAgEADQvaeQVn5wIe0Mu0i0ksIBGUUMptNPQtv32jtyxZWZImB7htKCbKQjBOdPAdF5cdcukwSUUyeG1gGHSkbB7ry2i1wM2KQ3sNGLP0kz56uU@gE ``` x=input() x+=x[::-1] i=-1 for c in x[:-1]:print(c*(i>-1)+" "*i+c);i+=1 print(x) ``` Three improvements: 1. Use `x[::-1]` instead of `x[-2::-1]` 2. Us...
(more)
over 2 years ago
Comment Post #283978 Since `i` is always non-negative, you can shave off 2 bytes by replacing `bool(i)` with `(i>0)`
(more)
over 2 years ago
Comment Post #283969 You can easily remove a few bytes by just using `print("Hello, "..io.read().."!")`
(more)
over 2 years ago
Comment Post #283908 I've updated the question. Is there anything else that's confusing?
(more)
over 2 years ago
Comment Post #283428 @#53837 The main problem is keeping it null terminated. I cannot insert a null terminator since I can't edit the input string array, and other methods like creating a new string seem more hassle than it would save.
(more)
over 2 years ago
Comment Post #283383 @#53588 Thanks!
(more)
over 2 years ago