Skip to content

Instantly share code, notes, and snippets.

@UnendingLoop
UnendingLoop / main.go
Created October 7, 2025 12:36
3rd task: I assumed that only creating new output file is allowed, not writing to an existing one. I used sending slices in channel, also possible to implement sending single numbers if necessary.
package main
import (
"context"
"errors"
"flag"
"fmt"
"log"
"os"
"strconv"
@UnendingLoop
UnendingLoop / main_test.go
Last active October 7, 2025 12:45
2nd task
package main
import "testing"
func TestGetScore(t *testing.T) {
tests := []struct {
name string
input []ScoreStamp
offset int
expected Score
@UnendingLoop
UnendingLoop / getScore.go
Last active October 7, 2025 12:36
1st task
// getScore returns score for specified offset from slice gameStamps.
// If offset is not found, it returns empty Score.
func getScore(gameStamps []ScoreStamp, offset int) Score {
if len(gameStamps) == 0 {
return Score{}
}
for _, stamp := range gameStamps {
if stamp.Offset == offset {
return stamp.Score