         let resetScores$ = resetScoresButton.rx.tap
             .map { _ in defaultGameState }
             .startWith(defaultGameState)
+        
+        let playerModeChange$ = playerModeSwitch.rx.value
+            .debug("player mode changed")
+            .do(onNext: { (state) in
+                print("mode change \(state)")
+            })
+            .map { value in
+                value ? defaultGameState : defaultAIGameState
+            }
         
         // MARK: Cell clickstreams
         let clicks$: Array<Observable<(uiElement: UIButton, position: Position)>> = self.cells.reduce([], { result, cell in

        
        self.newGameButton.alpha = 0
        
        
        // handle reset merges by flatMap
        // MARK: New Game

    @IBOutlet weak var gameEndMessage: UILabel!
    @IBOutlet weak var newGameButton: UIButton!
    
    @IBOutlet weak var playerModeSwitch: UISwitch!
    
    private let disposeBag = DisposeBag()
    private var cells: Array<Cell> = []
