Activity for radarekā
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Golf golf challenge Ruby, 100 96 bytes According to the rules, trailing white spaces and line feed are allowed and my program uses that: ```ruby ->p,s{"Par Bogey Double bogey Triple bogey Hole in one Albatross Eagle Birdie".lines[s<2?4:s-p]} ``` Try this online! (more) |
— | almost 3 years ago |
Edit | Post #285496 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Roll n fair dice Ruby, 27 24 bytes ->n,m{eval'-rand(m)'n} Attempt This Online! If we change the order of `n, m` parameters to `m, n` then following 23 bytes version work, but only in ruby 2.7 (it does not work in 3.x - bug or feature?): ```ruby ->{eval'-rand(1)'2} ``` (more) |
— | almost 3 years ago |
Edit | Post #285480 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285482 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285482 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285482 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Evaluate a single variable polynomial equation Ruby, 29 bytes ```ruby ->l,x{a,b=l;a ?a+xf[b,x]:0} ``` Try it online (more) |
— | almost 3 years ago |
Edit | Post #285480 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285480 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285480 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285480 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Determine whether an integer is square-free Ruby, 27 bytes ```ruby ->n{(2..n).all?{n%12>0}} ``` Try it online (more) |
— | almost 3 years ago |
Comment | Post #285404 |
@#53310 Good catch, thanks! (more) |
— | almost 3 years ago |
Comment | Post #285331 |
```ruby
->a,b,c{%w[+ - * / % **].select{eval"a#{_1}b==c"}}
```
(more) |
— | almost 3 years ago |
Comment | Post #285404 |
You can make it 1b shorter by using `$><<` to output value in P2:
```
puts"$><<#{gets}+gets.to_i"
```
(more) |
— | almost 3 years ago |
- ← Previous
- 1
- 2
- 3
- Next →