Feat: word loader

This commit is contained in:
Grail Finder
2025-05-13 07:49:16 +03:00
parent f752d2a162
commit 0c94811632
5 changed files with 6043 additions and 31 deletions

View File

@ -103,36 +103,45 @@ func (r *Room) UpdateCounter() {
r.BlueCounter = blueCounter
}
func (r *Room) LoadTestCards() {
cards := []WordCard{
{Word: "hamster", Color: "blue"},
{Word: "child", Color: "red"},
{Word: "wheel", Color: "white"},
{Word: "condition", Color: "black"},
{Word: "test", Color: "white"},
{Word: "ball", Color: "blue"},
{Word: "violin", Color: "red"},
{Word: "rat", Color: "white"},
{Word: "perplexity", Color: "blue"},
{Word: "notion", Color: "red"},
{Word: "guitar", Color: "blue"},
{Word: "ocean", Color: "blue"},
{Word: "moon", Color: "blue"},
{Word: "coffee", Color: "blue"},
{Word: "mountain", Color: "blue"},
{Word: "book", Color: "blue"},
{Word: "camera", Color: "blue"},
{Word: "apple", Color: "red"},
{Word: "fire", Color: "red"},
{Word: "rose", Color: "red"},
{Word: "sun", Color: "red"},
{Word: "cherry", Color: "red"},
{Word: "heart", Color: "red"},
{Word: "tomato", Color: "red"},
{Word: "cloud", Color: "white"},
}
r.Cards = cards
}
// func (r *Room) LoadTestCards() {
// // TODO: pass room settings
// // TODO: map language to path
// wl := wordloader.InitDefaultLoader("assets/words/en_nouns.txt")
// cards, err := wl.Load()
// if err != nil {
// // no logger
// fmt.Println("failed to load cards", "error", err)
// }
// r.Cards = cards
// // cards := []WordCard{
// // {Word: "hamster", Color: "blue"},
// // {Word: "child", Color: "red"},
// // {Word: "wheel", Color: "white"},
// // {Word: "condition", Color: "black"},
// // {Word: "test", Color: "white"},
// // {Word: "ball", Color: "blue"},
// // {Word: "violin", Color: "red"},
// // {Word: "rat", Color: "white"},
// // {Word: "perplexity", Color: "blue"},
// // {Word: "notion", Color: "red"},
// // {Word: "guitar", Color: "blue"},
// // {Word: "ocean", Color: "blue"},
// // {Word: "moon", Color: "blue"},
// // {Word: "coffee", Color: "blue"},
// // {Word: "mountain", Color: "blue"},
// // {Word: "book", Color: "blue"},
// // {Word: "camera", Color: "blue"},
// // {Word: "apple", Color: "red"},
// // {Word: "fire", Color: "red"},
// // {Word: "rose", Color: "red"},
// // {Word: "sun", Color: "red"},
// // {Word: "cherry", Color: "red"},
// // {Word: "heart", Color: "red"},
// // {Word: "tomato", Color: "red"},
// // {Word: "cloud", Color: "white"},
// // }
// // r.Cards = cards
// }
func (r *Room) ChangeTurn() {
switch r.TeamTurn {