03-25-2021, 03:30 AM
(This post was last modified: 03-25-2021, 05:22 AM by dale walton.
Edit Reason: Result of further testing
)
I need information on how this works.
I tried to create a phase to handle cases where the board position has returned to a previous state, but
{
(nextPhase (not (is Repeat Situational)) "NormalPlay")
(nextPhase (is Repeat Situational) "ReducePieces")
}
didn't leave any moves after the first placement, (and hangs upon passing) whereas the program had been working fine before.
Is (is Repeat Situational) always true at the end of a turn?
or are there still bugs in its implementation.
The following is the change to my FamilyOfFour game main routine. (refer to the other thread regarding hanging AI and analysis)
(game "Family of Four"
(players 2)
(equipment
{
(board "BoardUsed" use:Vertex)
(piece "Piece1" P1 )
(piece "Piece2" P1 )
(piece "Piece3" P1 )
(piece "Piece1" P2 )
(piece "Piece2" P2 )
(piece "Piece3" P2 )
}
)
(rules
(start (set Score Each 0))
phases:{
(phase "NormalPlay"
(play
(priority
(or
{
("AddPiece" "Piece1")
("AddPiece" "Piece2")
("AddPiece" "Piece3")
}
)
("StepPiece")
(then
(and
("CheckWinCondition")
(set NextPlayer (player (next)) (then (moveAgain)))
))))
{
(nextPhase Next (not (is Repeat Situational)) "NormalPlay")
(nextPhase Next (is Repeat Situational) "ReducePieces")
}
)
(phase "ReducePieces"
(play
(forEach Piece
(move Remove (from)
(then
(moveAgain)
))
All
))
(end
(if
(= 0 (count Sites in:(difference (sites Board) (sites Empty))))
(byScore)
))
{
(nextPhase Mover (not (is Repeat Situational)) "NormalPlay")
(nextPhase (is Repeat Situational) "ReducePieces")
}
)
}
(end
(if
(< 0 (score Mover))
(byScore)
))))
The following parts were added in to see what happens, but didn't help. The problem exists without them.
(set NextPlayer (player (next)) (then (moveAgain)))
and Mover and Next in the (nextPhase ...) statements
---------------------------------------------------------------------------------
Changing to "Positional" works OK (but is not what I want....)
But "InGame" also hangs.
-------------------------------------------------------------------------------
Positional doesn't seem to be triggered by a forced Pass - Why not?
-------------------------------------------------------------------------------
The concept I am trying to implement is that if a situational repetition happens, the player in the repeated position must remove any players' pieces one at a time until the position is a new position, and following that take his normal turn.
A situational repeat in this concept included consecutive forced passes due to no moves available to either player. (which I assume should happen if the consecutive pass does not end the game...)
I tried to create a phase to handle cases where the board position has returned to a previous state, but
{
(nextPhase (not (is Repeat Situational)) "NormalPlay")
(nextPhase (is Repeat Situational) "ReducePieces")
}
didn't leave any moves after the first placement, (and hangs upon passing) whereas the program had been working fine before.
Is (is Repeat Situational) always true at the end of a turn?
or are there still bugs in its implementation.
The following is the change to my FamilyOfFour game main routine. (refer to the other thread regarding hanging AI and analysis)
(game "Family of Four"
(players 2)
(equipment
{
(board "BoardUsed" use:Vertex)
(piece "Piece1" P1 )
(piece "Piece2" P1 )
(piece "Piece3" P1 )
(piece "Piece1" P2 )
(piece "Piece2" P2 )
(piece "Piece3" P2 )
}
)
(rules
(start (set Score Each 0))
phases:{
(phase "NormalPlay"
(play
(priority
(or
{
("AddPiece" "Piece1")
("AddPiece" "Piece2")
("AddPiece" "Piece3")
}
)
("StepPiece")
(then
(and
("CheckWinCondition")
(set NextPlayer (player (next)) (then (moveAgain)))
))))
{
(nextPhase Next (not (is Repeat Situational)) "NormalPlay")
(nextPhase Next (is Repeat Situational) "ReducePieces")
}
)
(phase "ReducePieces"
(play
(forEach Piece
(move Remove (from)
(then
(moveAgain)
))
All
))
(end
(if
(= 0 (count Sites in:(difference (sites Board) (sites Empty))))
(byScore)
))
{
(nextPhase Mover (not (is Repeat Situational)) "NormalPlay")
(nextPhase (is Repeat Situational) "ReducePieces")
}
)
}
(end
(if
(< 0 (score Mover))
(byScore)
))))
The following parts were added in to see what happens, but didn't help. The problem exists without them.
(set NextPlayer (player (next)) (then (moveAgain)))
and Mover and Next in the (nextPhase ...) statements
---------------------------------------------------------------------------------
Changing to "Positional" works OK (but is not what I want....)
But "InGame" also hangs.
-------------------------------------------------------------------------------
Positional doesn't seem to be triggered by a forced Pass - Why not?
-------------------------------------------------------------------------------
The concept I am trying to implement is that if a situational repetition happens, the player in the repeated position must remove any players' pieces one at a time until the position is a new position, and following that take his normal turn.
A situational repeat in this concept included consecutive forced passes due to no moves available to either player. (which I assume should happen if the consecutive pass does not end the game...)