public class Scoreboard
{
    private String team1Name, team2Name;
    private int team1Points, team2Points;
    private boolean team1Active;
    
    public Scoreboard(String team1Name, String team2Name)
    {
        this.team1Name = team1Name;
        this.team2Name = team2Name;
        team1Points = 0;
        team2Points = 0;
        team1Active = true;
    }
    
    public void recordPlay(int points)
    {
        if(points != 0)
        {
            if(team1Active)
                team1Points += points;
            else
                team2Points += points;
        }
        else
        {
            team1Active = ! team1Active;
        }
    }
    
    public String getScore()
    {
        String activeTeamName = team1Name;
        if( ! team1Active )
            activeTeamName = team2Name;
        
        return team1Points + "-" + team2Points + "-" + activeTeamName;
    }
}
