본문 바로가기

⚽ 국내축구

국내 축구 커뮤니티 | K리그 소식, 축구 경기 결과, 팬들의 축구 토론

🕰️ 2023.07.07 21:56
[해축백일장] FiveBigLeagues.ts
조회 수 106 추천 수 0 댓글 0

단축키

Prev이전 문서

Next다음 문서

단축키

Prev이전 문서

Next다음 문서

class Team {

public name: string;

public city: string;

public point: number;

public manager: string;

public players: string[];

public tactics: 'normal' | 'experimental';

 

constructor(name: string, city: string) {

this.name = name;

this.city = city;

this.point = 0;

this.manager = '';

this.players = [];

this.tactics = 'normal';

}

}

 

abstract class League {

public fixture: Team[];

public numberOfTeams: number;

 

constructor(teamList: Team[]) {

this.fixture = teamList;

this.numberOfTeams = teamList.length;

}

 

protected rank() {

this.fixture.sort((a, b) => b.point - a.point);

}

 

public match(homeTeam: Team, awayTeam: Team) {

const result = Math.floor(Math.random() * 3);

 

if (result == 0) {

homeTeam.point += 3;

} else if (result == 1) {

awayTeam.point += 3;

} else {

homeTeam.point += 1;

awayTeam.point += 1;

}

 

this.rank();

}

 

abstract finalRound(): void;

}

 

class PremierLeague extends League {

finalRound() {

if (this.fixture[0].manager == 'Pep Guardiola' && this.fixture[0].tactics != 'experimental')

console.log('Treble!');

}

}

 

class LaLiga extends League {

finalRound() {

if ((this.fixture[0].name == 'Real Madrid' || 'Barcelona')

|| (this.fixture[0].name == 'Atletico Madrid' && this.fixture[0].tactics == 'experimental')) {

console.log(`${this.fixture[0].name} is the Champion!`);

} else throw Error('Not LaLiga!');

}

}

 

class SerieA extends League {

finalRound() {

const minjae = this.fixture[0].players.findIndex(player => player == 'Minjae Kim')

if (minjae != -1) this.fixture[0].players.splice(minjae, 1);

}

}

 

class Bundesliga extends League {

finalRound() {

if (this.fixture[0].name != 'Bayern Munich') {

console.log('Assist by Jaesung Lee!');

this.fixture[0].point -= 2;

this.rank();

}

}

}

 

class LigueUn extends League {

finalRound() {

if (this.fixture[0].manager == 'Christophe Galtier') {

console.log('Arrested!');

this.fixture[0].manager = 'Luis Enrique';

}

}

}


⚽ 국내축구

국내 축구 커뮤니티 | K리그 소식, 축구 경기 결과, 팬들의 축구 토론

List of Articles
번호 분류 제목 조회 수 날짜
공지 공지 축구 실시간 무료로 보는 방법 2109 2024.03.21
공지 잡담 ▶ 공지사항 ◀ 축구 게시판 공지사항 (23.10.10) 5975 2023.10.10
공지 🚨(뉴비필독) 전체공지 & 포인트안내 22 29455 2024.11.04
공지 URL만 붙여넣으면 끝! 임베드 기능 23334 2025.01.21
37424 - 선착순 한명 - 73 2022.01.25
37423 -_- 입갤 41 2022.03.07
37422 -돈- 죽여버리고 싶다 31 2021.10.11
37421 -짱- 새끼들 때문에 레전드 선수들이 팬들 기립박수도 못받고 떠나는구나 31 2021.08.08
37420 -차-피해서 티빙왔더니 25 2021.10.26
37419 -플스인을 만나다- "해축갤 머장"편 file 36 2022.02.05
37418 ? 36 2022.02.18
37417 ? 26 2021.11.08
37416 ? 35 2022.02.18
37415 ? file 28 2021.09.24
37414 ? file 26 2021.09.04
37413 ? file 34 2021.09.12
37412 ? 59 2023.06.22
37411 ? file 33 2021.09.21
37410 ? ㅁ팁 골 뭐냐 292 2022.04.01
37409 ? 로저 마르티 pk 실축 257 2022.04.11
37408 ? 머야 대전에서 칠레전 함??? file 407 2022.05.28
37407 ? 뭐하냐 39 2021.12.28
37406 ? 미나미노 또 우승컵 들때 카메라 움직이는거 뭐냐 25 2022.02.28
37405 ? 한지호 방금 파울 아닌거 같은데 ㅋㅋㅋㅋㅋㅋㅋㅋ 23 2021.08.08
37404 ? 헛발질같은데 23 2021.09.27
37403 ?? : 메시 넌아직 멀었다 file 30 2021.09.20
37402 ?? : 여러분 음해를 멈춰주세요 file 20 2021.11.06
37401 ?? ??: 길거리에 갈때마다 사람들이 나보고 꺼지라고 했다. 매일이 괴롭힘이었다 1300 2022.06.24
37400 ?? 가르나초 이새끼 뭐야 file 71 2022.03.08
37399 ?? 일본 왜짐 25 2021.09.02
37398 ??: 로만 매각.... 평푸싫 32 2022.03.03
37397 ??: 맨시티가 저한테 제의를 했어요 file 51 2023.07.02
37396 ??: 올해 몇 명의 아내와 잤나? file 30 2021.11.09
37395 ??? file 36 2022.02.17
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 1248 Next
/ 1248