I have a struct that looks like this:
defmodule WarGame.Core.Game do
defstruct user_cards: [],
croupier_cards: [],
user_bets: [],
bets: [:card_odd, :color_player],
deck: %{},
used: [],
title: nil
I would like to create a function that can take a chosen element of a list bets and move it to user_bets. How could I achieve this? There will be only finite (5) elements in this list.
In my head it looks something like this:
def select_bet(bet) do
finds bet in %WarGame.Core.Game{}.bets
inserts it to %WarGame.Core.Game{}.user_bets
end
How can I achieve this?