18 lines
343 B
Go
18 lines
343 B
Go
package main
|
|
|
|
func NewInMemoryPlayerStore() *InMemoryPlayerStore {
|
|
return &InMemoryPlayerStore{map[string]int{}}
|
|
}
|
|
|
|
type InMemoryPlayerStore struct {
|
|
store map[string]int
|
|
}
|
|
|
|
func (i *InMemoryPlayerStore) RecordWin(name string) {
|
|
i.store[name]++
|
|
}
|
|
|
|
func (i *InMemoryPlayerStore) GetPlayerScore(name string) int {
|
|
return i.store[name]
|
|
}
|