Commit b5515f2a authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into feat/l1-deployments

parents f5f5e275 1f93dbae
...@@ -32,38 +32,14 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C ...@@ -32,38 +32,14 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C
if agreeWithClaimLevel { if agreeWithClaimLevel {
return nil, nil return nil, nil
} }
if claim.Depth() == s.gameDepth {
// Special case of the root claim return nil, types.ErrGameDepthReached
if claim.IsRoot() {
return s.handleRoot(claim)
} }
return s.handleMiddle(claim)
}
func (s *Solver) handleRoot(claim types.Claim) (*types.Claim, error) {
agree, err := s.agreeWithClaim(claim.ClaimData) agree, err := s.agreeWithClaim(claim.ClaimData)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Attack the root claim if we do not agree with it if agree {
// Note: We always disagree with the claim level at this point,
// so if we agree with claim maybe we should also attack?
if !agree {
return s.attack(claim)
} else {
return nil, nil
}
}
func (s *Solver) handleMiddle(claim types.Claim) (*types.Claim, error) {
claimCorrect, err := s.agreeWithClaim(claim.ClaimData)
if err != nil {
return nil, err
}
if claim.Depth() == s.gameDepth {
return nil, types.ErrGameDepthReached
}
if claimCorrect {
return s.defend(claim) return s.defend(claim)
} else { } else {
return s.attack(claim) return s.attack(claim)
...@@ -131,6 +107,9 @@ func (s *Solver) attack(claim types.Claim) (*types.Claim, error) { ...@@ -131,6 +107,9 @@ func (s *Solver) attack(claim types.Claim) (*types.Claim, error) {
// defend returns a response that defends the claim. // defend returns a response that defends the claim.
func (s *Solver) defend(claim types.Claim) (*types.Claim, error) { func (s *Solver) defend(claim types.Claim) (*types.Claim, error) {
if claim.IsRoot() {
return nil, nil
}
position := claim.Defend() position := claim.Defend()
value, err := s.traceAtPosition(position) value, err := s.traceAtPosition(position)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment