Documentation ¶
Overview ¶
flag contains a battleline flag.
Index ¶
- type Flag
- func (flag *Flag) ClaimFlag(playerix int, unPlayCards []int) (ok bool, eks []int)
- func (flag *Flag) Claimed() bool
- func (flag *Flag) Copy() (c *Flag)
- func (flag *Flag) Env(pix int) (env []int)
- func (flag *Flag) Equal(o *Flag) (equal bool)
- func (flag *Flag) Formations() (form [2]*cards.Formation)
- func (flag *Flag) Free() (v [2]bool)
- func (flag *Flag) Remove(cardix int, playerix int) (mudix0 int, mudix1 int, err error)
- func (flag *Flag) Set(cardix int, playerix int) (err error)
- func (flag *Flag) String() (txt string)
- func (flag *Flag) Troops(pix int) (troops []int)
- func (flag *Flag) UsedTac() (v [2][]int)
- func (flag *Flag) Won() (res [2]bool)
- type Player
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flag ¶
type Flag struct {
Players [2]*Player
}
Flag the structer of the flag.
func (*Flag) ClaimFlag ¶
ClaimFlag claims a flag if possible. Its only possible to claim a flag if player have a formation, if both players have a formation it is easy, or if player have the highest formation. The main task is calculate the highest possible formation. I do not have a plan yet but I think we need brute force, but If we are missing four cards and only one combi exist, it's 53*52*51*54=0/24 permutaitions ca 300.000 and how do generate them. The player's formation do limit the possible formation to the ones that are better but again that may be many all to be exact, but if we find one that is better we can stop. I see 3 option:
- Just try all permution and if one is higher stop.
- For every combination try to make one with the remaining cards
- A combination a quick check if player have two troops many combination can be ruled out. color, value and bigger bridge than 2 no line. These three check give a max combination. ranging from top to button
Made permutaitor and will try that first it may be quick ennough. Have the plan for the second solution. Sort the remaining cards a value/card map per color and a value slice of cards map. Then a switch with drop through on the combination and each combination function use the sorted cards
func (*Flag) Formations ¶
Formations returns players formations.
func (*Flag) Remove ¶
Remove removes a card from the flag. mudix0 contains a card if removal of the mud card result in an excess card for player 0/1