Dependancy between flags
This commit is contained in:
parent
711db60a4c
commit
f9abdd23c6
8 changed files with 111 additions and 1 deletions
|
|
@ -124,6 +124,25 @@ func (t Team) CanDownload(f EFile) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// CanSeeFlag checks if the Team has access to the given flag.
|
||||
func (t Team) CanSeeFlag(k Flag) bool {
|
||||
if deps, err := k.GetDepends(); err != nil {
|
||||
log.Printf("Unable to retrieve flag dependencies: %s\n", err)
|
||||
return false
|
||||
} else {
|
||||
res := true
|
||||
|
||||
for _, dep := range deps {
|
||||
if t.HasPartiallySolved(dep) == nil {
|
||||
res = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
// NbTry retrieves the number of attempts made by the Team to the given challenge.
|
||||
func NbTry(t *Team, e Exercice) int {
|
||||
var cnt *int
|
||||
|
|
|
|||
Reference in a new issue