Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
75bef5bd
Unverified
Commit
75bef5bd
authored
Sep 13, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Add rule to prevent defending the root claim.
parent
64a91e60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
rules.go
op-challenger/game/fault/solver/rules.go
+8
-0
No files found.
op-challenger/game/fault/solver/rules.go
View file @
75bef5bd
...
@@ -15,6 +15,7 @@ var rules = []actionRule{
...
@@ -15,6 +15,7 @@ var rules = []actionRule{
onlyMoveBeforeMaxDepth
,
onlyMoveBeforeMaxDepth
,
onlyCounterClaimsAtDisagreeingLevels
,
onlyCounterClaimsAtDisagreeingLevels
,
doNotDuplicateExistingMoves
,
doNotDuplicateExistingMoves
,
doNotDefendRootClaim
,
}
}
func
checkRules
(
game
types
.
Game
,
action
types
.
Action
)
error
{
func
checkRules
(
game
types
.
Game
,
action
types
.
Action
)
error
{
...
@@ -75,6 +76,13 @@ func doNotDuplicateExistingMoves(game types.Game, action types.Action) error {
...
@@ -75,6 +76,13 @@ func doNotDuplicateExistingMoves(game types.Game, action types.Action) error {
return
nil
return
nil
}
}
func
doNotDefendRootClaim
(
game
types
.
Game
,
action
types
.
Action
)
error
{
if
game
.
Claims
()[
action
.
ParentIdx
]
.
IsRootPosition
()
&&
!
action
.
IsAttack
{
return
fmt
.
Errorf
(
"defending the root claim at idx %v"
,
action
.
ParentIdx
)
}
return
nil
}
func
resultingPosition
(
game
types
.
Game
,
action
types
.
Action
)
types
.
Position
{
func
resultingPosition
(
game
types
.
Game
,
action
types
.
Action
)
types
.
Position
{
parentPos
:=
game
.
Claims
()[
action
.
ParentIdx
]
.
Position
parentPos
:=
game
.
Claims
()[
action
.
ParentIdx
]
.
Position
if
action
.
Type
==
types
.
ActionTypeStep
{
if
action
.
Type
==
types
.
ActionTypeStep
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment