Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006938 [Croquet] Any major always 02-20-08 13:54 02-20-08 13:54
Reporter Twain View Status public  
Assigned To
Priority normal Resolution open  
Status new  
Summary 0006938: CHESS game: pari passu move
Description Error message: WHITE BROKEN


The order of play:

WHITE BLACK
    
e2 --- e4 Ng8 --- f6
Nb1 --- c3 d7 --- d5
d2 --- d3 d5 --- d4
Nc3 --- d5 Nf6 --- d5
e4 --- d5 Qd8 --- d5
Ng1 --- f3 e7 --- e5
c2 --- c4 d4 --- c3 (pari passu)
c4 pawn disappears
    
    


DEBUG BROWSER
================

(I) ChessMorph(Object)>>error:
(II) ChessMorph>>validateGamePosition
(III) ChessMorph>>completedMove:white:
(IV) ChessBoard>>nextMove:
(V) ChessBoard>>movePieceFrom:to:
(VI) ChessMorph>>step
(VII) ChessMorph(Morph)>>stepAt:
(VIII) StepMessage(MorphicAlarm)>>value:
(IX) WorldState>>runLocalStepMethodsIn:
(X) WorldState>>runStepMethodsIn:
(XI) PasteUpMorph>>runStepMethods
(XII) WorldState>>doOneCyleNowFor:
(XIII) WorldState>>doOneCyleFor:
(XIV) PasteUpMorph>>doOneCycle
(XV) [] in Project class>>spawnNewProcess{[[World doOneCycle. Processor yield. false] whileFalse. nil]}
(XVI) [] in BlockContext>>newProcess {[self value. Processor terminateActive]}



DETAIL
======

(I) ChessMorph(Object)>>error:

error: aString
    "Throw a generic Error exception."

    ^Error new signal: aString




(II) ChessMorph>>validateGamePosition

validateGamePosition
    "This method does nothing but validating what you see (on screen) is what you get (from the board)."
    | square piece isWhite p |
    1 to: 64 do:[:idx|
        square := self atSquare: idx.
        square hasSubmorphs
            ifTrue:[piece := square firstSubmorph valueOfProperty: #piece.
                    isWhite := square firstSubmorph valueOfProperty: #isWhite]
            ifFalse:[piece := 0. isWhite := nil].
        p := board whitePlayer pieceAt: idx.
        idx = board whitePlayer castlingRookSquare ifTrue:[p := ChessPlayer rook].
        isWhite == true ifTrue:[
            p = piece ifFalse:[self error:'White broken'].
        ] ifFalse:[p = 0 ifFalse:[self error:'White broken']].
        p := board blackPlayer pieceAt: idx.
        idx = board blackPlayer castlingRookSquare ifTrue:[p := ChessPlayer rook].
        isWhite == false ifTrue:[
            p = piece ifFalse:[self error:'White broken'].
        ] ifFalse:[p = 0 ifFalse:[self error:'White broken']].
    ].




(III) ChessMorph>>completedMove:white:

completedMove: aMove white: aBool
    board ifNil:[^self].
    history addLast: aMove.
    self validateGamePosition.




(IV) ChessBoard>>nextMove:

nextMove: aMove
    activePlayer applyMove: aMove.
    userAgent
        ifNotNil: [userAgent completedMove: aMove white: activePlayer isWhitePlayer].
    activePlayer := activePlayer == whitePlayer
                ifTrue: [blackPlayer]
                ifFalse: [whitePlayer].
    activePlayer prepareNextMove




(V) ChessBoard>>movePieceFrom:to:

movePieceFrom: sourceSquare to: destSquare
    | move |
    searchAgent isThinking ifTrue:[^self].
    move := (activePlayer findPossibleMovesAt: sourceSquare) contents
        detect:[:any| any destinationSquare = destSquare].
    self nextMove: move.
    searchAgent activePlayer: activePlayer.




(VI) ChessMorph>>step

step
    | move |
    board searchAgent isThinking ifTrue:[
        move := board searchAgent thinkStep.
        move ifNotNil:[
            animateMove := true.
            board movePieceFrom: move sourceSquare
                    to: move destinationSquare].
    ] ifFalse:[
        autoPlay ifTrue:[board searchAgent startThinking].
    ].




(VII) ChessMorph(Morph)>>stepAt:

stepAt: millisecondClockValue
    "Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message.
    The millisecondClockValue parameter gives the value of the millisecond clock at the moment of dispatch.
    Default is to dispatch to the parameterless step method for the morph, but this protocol makes it possible for some morphs to do differing things depending on the clock value"
    self player ifNotNilDo:[:p| p stepAt: millisecondClockValue].
    self step




(VIII) StepMessage(MorphicAlarm)>>value:

value: anArgument
    | nArgs |
    numArgs ifNil:[numArgs := selector numArgs].
    nArgs := arguments ifNil:[0] ifNotNil:[arguments size].
    nArgs = numArgs ifTrue:[
        "Ignore extra argument"
        ^self value].
    ^arguments isNil
        ifTrue: [receiver perform: selector with: anArgument]
        ifFalse: [receiver perform: selector withArguments: (arguments copyWith: anArgument)]




(IX) WorldState>>runLocalStepMethodsIn:

runLocalStepMethodsIn: aWorld
    "Run morph 'step' methods (LOCAL TO THIS WORLD) whose time has come. Purge any morphs that are no longer in this world.
    ar 3/13/1999: Remove buggy morphs from the step list so that they don't raise repeated errors."

    | now morphToStep stepTime priorWorld |
    now := Time millisecondClockValue.
    priorWorld := ActiveWorld.
    ActiveWorld := aWorld.
    self triggerAlarmsBefore: now.
    stepList isEmpty
        ifTrue:
            [ActiveWorld := priorWorld.
            ^self].
    (now < lastStepTime or: [now - lastStepTime > 5000])
        ifTrue: [self adjustWakeupTimes: now]. "clock slipped"
    [stepList isEmpty not and: [stepList first scheduledTime < now]]
        whileTrue:
            [lastStepMessage := stepList removeFirst.
            morphToStep := lastStepMessage receiver.
            (morphToStep shouldGetStepsFrom: aWorld)
                ifTrue:
                    [lastStepMessage value: now.
                    lastStepMessage ifNotNil:
                            [stepTime := lastStepMessage stepTime ifNil: [morphToStep stepTime].
                            lastStepMessage scheduledTime: now + (stepTime max: 1).
                            stepList add: lastStepMessage]].
            lastStepMessage := nil].
    lastStepTime := now.
    ActiveWorld := priorWorld




(X) WorldState>>runStepMethodsIn:

runStepMethodsIn: aWorld
    "Perform periodic activity inbetween event cycles"
    | queue msg |

    queue := self class deferredUIMessages.
    [(msg := queue nextOrNil) == nil] whileFalse: [
        msg value.
    ].
    self runLocalStepMethodsIn: aWorld.

    "we are using a normal #step for these now"
    "aWorld allLowerWorldsDo: [ :each | each runLocalStepMethods ]."




(XI) PasteUpMorph>>runStepMethods

runStepMethods

    worldState runStepMethodsIn: self



 

(XII) WorldState>>doOneCyleNowFor:

doOneCycleNowFor: aWorld
    "Immediately do one cycle of the interaction loop.
    This should not be called directly, but only via doOneCycleFor:"

    | capturingGesture |
    DisplayScreen checkForNewScreenSize.
    capturingGesture := false.
    self flag: #bob. "need to consider remote hands in lower worlds"

    "process user input events"
    LastCycleTime := Time millisecondClockValue.
    self handsDo: [:h |
        ActiveHand := h.
        h processEvents.
        capturingGesture := capturingGesture or: [ h isCapturingGesturePoints ].
        ActiveHand := nil
    ].

    "the default is the primary hand"
    ActiveHand := self hands first.

    "The gesture recognizer needs enough points to be accurate.
    Therefore morph stepping is disabled while capturing points for the recognizer"
    capturingGesture ifFalse:
        [aWorld runStepMethods. "there are currently some variations here"
        self displayWorldSafely: aWorld].




(XIII) WorldState>>doOneCyleFor:

doOneCycleFor: aWorld
    "Do one cycle of the interaction loop. This method is called repeatedly when the world is running.

This is a moderately private method; a better alternative is usually either to wait for events or to check the state of things from #step methods."

    self interCyclePause: (Preferences higherPerformance ifTrue: [1] ifFalse: [MinCycleLapse]).
    self doOneCycleNowFor: aWorld.




(XIV) PasteUpMorph>>doOneCycle

doOneCycle
    "see the comment in doOneCycleFor:"

    worldState doOneCycleFor: self

 

(XV) [] in Project class>>spawnNewProcess{[[World doOneCycle. Processor yield. false] whileFalse. nil]}

spawnNewProcess

    UIProcess := [
        [World doOneCycle. Processor yield. false] whileFalse: [].
    ] newProcess priority: Processor userSchedulingPriority.
    UIProcess resume




(XVI) [] in BlockContext>>newProcess {[self value. Processor terminateActive]}

newProcess
    "Answer a Process running the code in the receiver. The process is not
    scheduled."
    <primitive: 19> "Simulation guard"
    ^Process
        forContext:
            [self value.
            Processor terminateActive] asContext
        priority: Processor activePriority
Additional Information After the error browser appears, if you click "Proceed" and twice onto the chessboard you can continue with the game, a move at a time but the error message re-apears.
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
02-20-08 13:54 Twain New Issue


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
27 total queries executed.
24 unique queries executed.
Powered by Mantis Bugtracker