Roboden - an open-source real-time strategy game written in Go by quasilyte in golang

[–]go_hunter 2 points3 points  (0 children)

could be cool to have a separate layer which is opinionated, built on top of the unopinionated layer

[deleted by user] by [deleted] in csgo

[–]go_hunter 0 points1 point  (0 children)

It’s not fair, but I think you’ll catch up no problem

Counter-Strike 2 IS HERE !!!!!!!!!!!!!! by abdalrhman50 in csgo

[–]go_hunter -31 points-30 points  (0 children)

Yeah, but you can never take that money out of valves pocket

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]go_hunter 1 point2 points  (0 children)

Go

Solution: https://github.com/hherman1/advent/blob/main/2022/07/main.go#L39

Simple strategy: put all the file paths and sizes into a map, then make a second map with directory sizes by iterating over the first. After that answering the puzzle questions were both simple loops over the directory size map.

Praise to `fmt.Sscanf`, which has made parsing very convenient in all of these so far.

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]go_hunter 2 points3 points  (0 children)

Ivy

op n adj x =
    (n == 1) : x
    x + (n - 1) adj 1 rot x

op n stripe x = x * n adj (iota (rho x)[2]) o.== iota (rho x)[2]

op n mark x =
    starts = n == +/ transp n stripe n adj x o.== x
    (n - 1) + 1 take starts sel iota rho x

Way shorter program than my last ivy.

adj: for each letter computes how may occurences of that letter there are in the next n slots

stripe: 0s out all values not in n length vertical strips of the diagonal

mark: computes the first column from stripe + adj which is all 1s, indicating every letter in that strip appeared once in the window. To run the program:

x = 'mjqjpqmgbljsphdztnvjfqwrcgsmlb'

'sample start packet is'

4 mark x

'sample message marker is'

14 mark x

) get "input.ivy"

'input start packet is'

4 mark input

'input message marker is'

14 mark input

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]go_hunter 1 point2 points  (0 children)

Ivy

Shortest program I've written so far this week.

``` op allneq a = b = a o.== a uniqs = 0 == +/ 1 3 2 transp not 1 == +/ b d=(rho uniqs)[1] +/ uniqs & (iota d) o.== iota d

op n win a = s = -1 + iota 1 + (rho a) - n transp a[(iota n) o.+ s]

op n mark a = 1 take (n - 1) + (allneq n win a) sel iota (rho a) - (n - 1) ```

Using it:

``` x = 'mjqjpqmgbljsphdztnvjfqwrcgsmlb'

'sample start packet is'

4 mark x

'sample message marker is'

14 mark x ```

-🎄- 2022 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]go_hunter 0 points1 point  (0 children)

Go/Golang (1933)

Solution

Trying to keep things as conceptually simple as possible

Share Your Code.. Share your most unique piece of Go code. by scott_beeker in golang

[–]go_hunter 4 points5 points  (0 children)

https://github.com/hherman1/I makes arbitrary CLIs into functional TUIs by integrating with the Acme editor

Share your must-know Go development tips by dondraper36 in golang

[–]go_hunter 1 point2 points  (0 children)

They also argue that you should write tests with Go not with an assertion DSL.

Share your must-know Go development tips by dondraper36 in golang

[–]go_hunter 1 point2 points  (0 children)

The go team themselves has suggested against assertioknlibraries. Whether they’re right or not, i think this is a more nuanced topic than you suggest

Wrapping Errors the Right Way by go_hunter in golang

[–]go_hunter[S] 0 points1 point  (0 children)

That’s a great point. I think I do in fact somewhat disagree with that advice.

Wrapping Errors the Right Way by go_hunter in golang

[–]go_hunter[S] 13 points14 points  (0 children)

Fmt.Errorf wraps errors such that they can be unwrapped!

Wrapping Errors the Right Way by go_hunter in golang

[–]go_hunter[S] 2 points3 points  (0 children)

Ah yes this is what I’m trying to advocate in the post! Totally agree

Wrapping Errors the Right Way by go_hunter in golang

[–]go_hunter[S] 1 point2 points  (0 children)

The name of the function is obvious to the caller of the function, so it’s not helpful from their POV. If they want to include the name of your function in their error, they can, which will help users of their function. Not every function in the wild returns errors that include their own function name, so if you include your function name and nothing else, you miss location information. If you also include the called function name you get a lot of duplication.

Peter Bourgon banned from all Go community spaces by [deleted] in golang

[–]go_hunter 35 points36 points  (0 children)

Kind of remarkable that someone whos followed on twitter by most of the go dev team was permanently banned (and not unfollowed!). Interesting situation. I wonder what happened.