<commit_before>import {Component, Injector, OnInit, ViewChild, ElementRef} from "@angular/core";
import {BlockBreakerService} from "../services/block-breaker.service";
import {BlockBreakerGame} from "../models/block-breaker-game";
import {AbstractGameComponent} from "../../../../abstracted-resources/components/abstract-game.component";
import {followMouseMove} from "../../../../shared/animations/follow-mouse-movement";
/**
 * Created by michellenightward on 4/26/17.
 */
@Component({
    selector: "block-breaker",
    templateUrl: "app/modules/games/block-breaker/components/block-breaker.component.html",
})
export class BlockBreakerComponent extends AbstractGameComponent implements OnInit{

    @ViewChild("blockBreakerCanvas") canvas: ElementRef;
    public gameService: BlockBreakerService;
    public mouseStatus: boolean = false;

    constructor(injector: Injector, gameService: BlockBreakerService) {
        super(injector, gameService);
    }

    public ngOnInit() {
        this.gameService.setCanvasInfoAndDraw(this.canvas);
    }

    public startGame() {
        console.log("start");
        this.gameService.startGame();
    }

    public gameOver() {
        console.log("stop");
        this.gameService.gameOver();
    }

    public isGameActive(): boolean {
        return this.gameService.gameInstance.active;
        // TODO: get a better way of juggling gameInstance.active while keeping in mind # of lives left
        // return this.gameService.gameInstance.active || this.gameLives() !== 3;
    }

    public gameScore(): number {
        return this.gameService.gameInstance.score;
    }

    public gameLives(): number {
        return this.gameService.numberOfLives;
    }

}<commit_msg>fixing lives handling in block breaker<commit_after>import {Component, Injector, OnInit, ViewChild, ElementRef} from "@angular/core";
import {BlockBreakerService} from "../services/block-breaker.service";
import {BlockBreakerGame} from "../models/block-breaker-game";
import {AbstractGameComponent} from "../../../../abstracted-resources/components/abstract-game.component";
import {followMouseMove} from "../../../../shared/animations/follow-mouse-movement";
/**
 * Created by michellenightward on 4/26/17.
 */
@Component({
    selector: "block-breaker",
    templateUrl: "app/modules/games/block-breaker/components/block-breaker.component.html",
})
export class BlockBreakerComponent extends AbstractGameComponent implements OnInit{

    @ViewChild("blockBreakerCanvas") canvas: ElementRef;
    public gameService: BlockBreakerService;
    public mouseStatus: boolean = false;

    constructor(injector: Injector, gameService: BlockBreakerService) {
        super(injector, gameService);
    }

    public ngOnInit() {
        this.gameService.setCanvasInfoAndDraw(this.canvas);
    }

    public startGame() {
        console.log("start");
        this.gameService.startGame();
    }

    public gameOver() {
        console.log("stop");
        this.gameService.gameOver();
    }

    public isGameActive(): boolean {
        return this.gameService.gameInstance.active;
    }

    public gameScore(): number {
        return this.gameService.gameInstance.score;
    }

    public gameLives(): number {
        return this.gameService.numberOfLives;
    }

}
{'fraction_non_alphanumeric': 0.12876712328767123, 'fraction_numerical': 0.0033485540334855404, 'mean_word_length': 3.4829467939972716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3874584', 'n_tokens_mistral': 930, 'n_tokens_neox': 895, 'n_words': 190}