ngOnInit() {
    this.status = this.board.bufferCount(2, 1)
      .map(boards => {
        let board1:Board = boards[0];
        let board2:Board = boards[1];
        if (board2.getNumberOfAliveCells() == 0)
          return 'No alive cells';
        else if (board1.equals(board2))
          return 'All cells stable';
        else
          return 'Cell development in progress...';
      })
      .startWith('No alive cells');

    this.highscore = this.generation.scan((a, b) => Math.max(a,b), 0);
  }
示例#2
0
 snaps(stream$: Observable<{}>): Observable<{}> {
   return stream$
     .bufferCount(2, 1)
     .concatMap(() => this.snap());
 }