←back to thread

159 points mpweiher | 2 comments | | HN request time: 0.419s | source
Show context
ajankovic ◴[] No.43673706[source]
I had time to spare so I toyed with the example exercise. Now I am not sure if I misunderstood something because solution is fairly simple using only channels: https://go.dev/play/p/tD8cWdKfkKW
replies(2): >>43673906 #>>43676713 #
1. sateesh ◴[] No.43673906[source]
Your example solution has only one player. Your solution won't work when there are multiple players.
replies(1): >>43674876 #
2. ajankovic ◴[] No.43674876[source]
I don't think you examined the code in full. main spawns 10 go routines that are constantly sending player scores to the game. That means 10 different players are sending their scores concurrently until someone reaches score of 100.