diff --git a/index.html b/index.html index d2c3c254..8ddb8692 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@

TypeScript Casino

- +
diff --git a/js/GameEngine.ts b/js/GameEngine.ts new file mode 100644 index 00000000..97b2beb5 --- /dev/null +++ b/js/GameEngine.ts @@ -0,0 +1,9 @@ +namespace Casino { + export abstract class GameEngine> + implements GameEngineInterface { + + abstract getGame(): GameType + abstract evaluateTurn(player: GameTypePlayer): void + abstract run(): void + } +} \ No newline at end of file diff --git a/js/GameEngineInterface.ts b/js/GameEngineInterface.ts new file mode 100644 index 00000000..fc57516a --- /dev/null +++ b/js/GameEngineInterface.ts @@ -0,0 +1,8 @@ +namespace Casino { + export interface GameEngineInterface> { + + getGame(): GameType; + evaluateTurn(player: GameTypePlayer): void; + run(): void; + } +} \ No newline at end of file diff --git a/js/GameInterface.ts b/js/GameInterface.ts new file mode 100644 index 00000000..637ec120 --- /dev/null +++ b/js/GameInterface.ts @@ -0,0 +1,10 @@ +namespace Casino { + export interface GameInterface { + + getPlayers(): T[]; + getPlayer(playerId: number): T; + addPlayer(player: T): void; + removePlayer(player: T): void; + contains(played: T): boolean; + } +} diff --git a/js/MainMenu.ts b/js/MainMenu.ts new file mode 100644 index 00000000..210d2405 --- /dev/null +++ b/js/MainMenu.ts @@ -0,0 +1,32 @@ +namespace Casino { + export class MainMenu { + displayElement: HTMLElement = document.getElementById("display"); + submitButton: HTMLElement = document.getElementById("submit_button"); + private userProfile: Profile; + + constructor(){ + this.menuStart = this.menuStart.bind(this); + this.createProfile = this.createProfile.bind(this); + this.gamePicker = this.gamePicker.bind(this); + } + + public menuStart() { + this.displayElement.innerHTML = "Please enter your name"; + this.submitButton.addEventListener("click",(e: Event) => this.createProfile(), {once: true}); + } + + private createProfile(){ + this.userProfile = new Profile(Input.getInput()); + this.displayElement.innerHTML += "
Hello " + this.userProfile.getuserName() +"!"; + this.displayElement.innerHTML += "
Please select a game.
1. Slots"; + this.submitButton.addEventListener("click",(e: Event) => this.gamePicker(), {once: true}); + } + + private gamePicker(){ + if(Input.getInput().toLowerCase() === 'slots'){ + var slotsGame = new SlotsGame(); + slotsGame.startGame(); + } + } + } +} \ No newline at end of file diff --git a/js/Player.ts b/js/Player.ts new file mode 100644 index 00000000..63d2b6c7 --- /dev/null +++ b/js/Player.ts @@ -0,0 +1,20 @@ +namespace Casino { + export class Player implements PlayerInterface { + + private playerProfile: Profile; + + constructorI(playerProfile: Profile) { + this.playerProfile = playerProfile; + } + + getProfile(): Profile { + return this.playerProfile; + } + getName(): string { + return this.playerProfile.getuserName(); + } + getId(): number { + return this.playerProfile.getUserId(); + } + } +} \ No newline at end of file diff --git a/js/PlayerInterface.ts b/js/PlayerInterface.ts new file mode 100644 index 00000000..ebf4bf53 --- /dev/null +++ b/js/PlayerInterface.ts @@ -0,0 +1,8 @@ +namespace Casino { + export interface PlayerInterface { + + getProfile(): Profile + getName(): string + getId(): number + } +} \ No newline at end of file diff --git a/js/Profile.ts b/js/Profile.ts new file mode 100644 index 00000000..cc801b2f --- /dev/null +++ b/js/Profile.ts @@ -0,0 +1,27 @@ +namespace Casino { + export class Profile { + + private userId: number; + private userName: string; + private balance: number; + + constructor(userName: string) { + this.userId = Math.random() * 1000; + this.userName = userName; + this.balance = 500; + } + + public getUserId(): number { + return this.userId; + } + + public getuserName(): string { + return this.userName; + } + + public getBalance(): number { + return this.balance; + } + + } +} \ No newline at end of file diff --git a/js/SlotsGame.ts b/js/SlotsGame.ts new file mode 100644 index 00000000..f8d2f935 --- /dev/null +++ b/js/SlotsGame.ts @@ -0,0 +1,78 @@ +namespace Casino{ + export class SlotsGame{ + + submitButton: HTMLElement = document.getElementById("submit_button"); + displayElement: HTMLElement = document.getElementById("display"); + private slotWheel1: string[] = ["۞","♕","⛄","∞","Ω","⁂"]; + private slotWheel2: string[] = ["Ω","۞","⁂","♕","⛄","∞"]; + private slotWheel3: string[] = ["♕","⛄","∞","⁂","Ω","۞"]; + + + public startGame(){ + var slotMachine = this.createMultipleWheelOutput(); + this.displaySlotMachine(slotMachine); + this.checkWinners(slotMachine); + this.displayElement.innerHTML += "
Type exit to quit or anything else to play again." + this.submitButton.addEventListener("click",(e: Event) => this.endGameChecker(), {once:true}); + } + + private endGameChecker(){ + if(Input.getInput().toLowerCase() != 'exit'){ + this.startGame(); + } + } + + private createMultipleWheelOutput(): string[][]{ + var slotMachine: string[][] = []; + slotMachine[0] = this.createSingleWheelOutput(this.slotWheel1); + slotMachine[1] = this.createSingleWheelOutput(this.slotWheel2); + slotMachine[2] = this.createSingleWheelOutput(this.slotWheel3); + return slotMachine; + } + + private createSingleWheelOutput(slotWheel: string[]): string[]{ + var newArray: string[] = []; + var position: number = Math.floor(Math.random() * 6); + for(var i = 0; i < 3; i++){ + if(position == 6){ + position = 0; + } + newArray[i] = slotWheel[position]; + position++; + } + return newArray; + } + + private displaySlotMachine(slotMachine: string[][]){ + this.displayElement.innerHTML += "
" + slotMachine[0][0] +" " + slotMachine[1][0] +" "+ slotMachine[2][0]; + this.displayElement.innerHTML += "
" + slotMachine[0][1] +" " + slotMachine[1][1] +" "+ slotMachine[2][1]; + this.displayElement.innerHTML += "
" + slotMachine[0][2] +" " + slotMachine[1][2] +" "+ slotMachine[2][2]; + } + + private checkWinners(slotMachine: string[][]){ + this.checkRowWinners(slotMachine); + this.checkDiagonalWinners(slotMachine); + } + + private checkRowWinners(slotMachine: string[][]){ + if(slotMachine[0][0] === slotMachine[1][0] && slotMachine[1][0]=== slotMachine[2][0]){ + this.displayElement.innerHTML += "
You have won on row 1!"; + } + if(slotMachine[0][1] === slotMachine[1][1] && slotMachine[1][1]=== slotMachine[2][1]){ + this.displayElement.innerHTML += "
You have won on row 2!"; + } + if(slotMachine[0][2] === slotMachine[1][2] && slotMachine[1][2]=== slotMachine[2][2]){ + this.displayElement.innerHTML += "
You have won on row 3!"; + } + } + + private checkDiagonalWinners(slotMachine: string[][]){ + if(slotMachine[0][0] === slotMachine[1][1] && slotMachine[1][1]=== slotMachine[2][2]){ + this.displayElement.innerHTML += "
You have won on diagonal down!"; + } + if(slotMachine[0][2] === slotMachine[1][1] && slotMachine[1][1]=== slotMachine[2][0]){ + this.displayElement.innerHTML += "
You have won on diagonal up!"; + } + } + } +} \ No newline at end of file diff --git a/js/app.js b/js/app.js new file mode 100644 index 00000000..d7acb90f --- /dev/null +++ b/js/app.js @@ -0,0 +1,166 @@ +var Casino; +(function (Casino) { + window.addEventListener("DOMContentLoaded", (e) => loadMainMenu()); + class Input { + static getInputFromBox() { + var element = document.getElementById("user_input"); + this.userinput = element.value; + element.value = ""; + } + static getInput() { + return this.userinput; + } + } + Casino.Input = Input; + document.getElementById("submit_button").addEventListener("click", (e) => Input.getInputFromBox()); + function loadMainMenu() { + var menu = new Casino.MainMenu(); + menu.menuStart(); + } +})(Casino || (Casino = {})); +var Casino; +(function (Casino) { + class GameEngine { + } + Casino.GameEngine = GameEngine; +})(Casino || (Casino = {})); +var Casino; +(function (Casino) { + class MainMenu { + constructor() { + this.displayElement = document.getElementById("display"); + this.submitButton = document.getElementById("submit_button"); + this.menuStart = this.menuStart.bind(this); + this.createProfile = this.createProfile.bind(this); + this.gamePicker = this.gamePicker.bind(this); + } + menuStart() { + this.displayElement.innerHTML = "Please enter your name"; + this.submitButton.addEventListener("click", (e) => this.createProfile(), { once: true }); + } + createProfile() { + this.userProfile = new Casino.Profile(Casino.Input.getInput()); + this.displayElement.innerHTML += "
Hello " + this.userProfile.getuserName() + "!"; + this.displayElement.innerHTML += "
Please select a game.
1. Slots"; + this.submitButton.addEventListener("click", (e) => this.gamePicker(), { once: true }); + } + gamePicker() { + if (Casino.Input.getInput().toLowerCase() === 'slots') { + var slotsGame = new Casino.SlotsGame(); + slotsGame.startGame(); + } + } + } + Casino.MainMenu = MainMenu; +})(Casino || (Casino = {})); +var Casino; +(function (Casino) { + class Player { + constructorI(playerProfile) { + this.playerProfile = playerProfile; + } + getProfile() { + return this.playerProfile; + } + getName() { + return this.playerProfile.getuserName(); + } + getId() { + return this.playerProfile.getUserId(); + } + } + Casino.Player = Player; +})(Casino || (Casino = {})); +var Casino; +(function (Casino) { + class Profile { + constructor(userName) { + this.userId = Math.random() * 1000; + this.userName = userName; + this.balance = 500; + } + getUserId() { + return this.userId; + } + getuserName() { + return this.userName; + } + getBalance() { + return this.balance; + } + } + Casino.Profile = Profile; +})(Casino || (Casino = {})); +var Casino; +(function (Casino) { + class SlotsGame { + constructor() { + this.submitButton = document.getElementById("submit_button"); + this.displayElement = document.getElementById("display"); + this.slotWheel1 = ["۞", "♕", "⛄", "∞", "Ω", "⁂"]; + this.slotWheel2 = ["Ω", "۞", "⁂", "♕", "⛄", "∞"]; + this.slotWheel3 = ["♕", "⛄", "∞", "⁂", "Ω", "۞"]; + } + startGame() { + var slotMachine = this.createMultipleWheelOutput(); + this.displaySlotMachine(slotMachine); + this.checkWinners(slotMachine); + this.displayElement.innerHTML += "
Type exit to quit or anything else to play again."; + this.submitButton.addEventListener("click", (e) => this.endGameChecker(), { once: true }); + } + endGameChecker() { + if (Casino.Input.getInput().toLowerCase() != 'exit') { + this.startGame(); + } + } + createMultipleWheelOutput() { + var slotMachine = []; + slotMachine[0] = this.createSingleWheelOutput(this.slotWheel1); + slotMachine[1] = this.createSingleWheelOutput(this.slotWheel2); + slotMachine[2] = this.createSingleWheelOutput(this.slotWheel3); + return slotMachine; + } + createSingleWheelOutput(slotWheel) { + var newArray = []; + var position = Math.floor(Math.random() * 6); + for (var i = 0; i < 3; i++) { + if (position == 6) { + position = 0; + } + newArray[i] = slotWheel[position]; + position++; + } + return newArray; + } + displaySlotMachine(slotMachine) { + this.displayElement.innerHTML += "
" + slotMachine[0][0] + " " + slotMachine[1][0] + " " + slotMachine[2][0]; + this.displayElement.innerHTML += "
" + slotMachine[0][1] + " " + slotMachine[1][1] + " " + slotMachine[2][1]; + this.displayElement.innerHTML += "
" + slotMachine[0][2] + " " + slotMachine[1][2] + " " + slotMachine[2][2]; + } + checkWinners(slotMachine) { + this.checkRowWinners(slotMachine); + this.checkDiagonalWinners(slotMachine); + } + checkRowWinners(slotMachine) { + if (slotMachine[0][0] === slotMachine[1][0] && slotMachine[1][0] === slotMachine[2][0]) { + this.displayElement.innerHTML += "
You have won on row 1!"; + } + if (slotMachine[0][1] === slotMachine[1][1] && slotMachine[1][1] === slotMachine[2][1]) { + this.displayElement.innerHTML += "
You have won on row 2!"; + } + if (slotMachine[0][2] === slotMachine[1][2] && slotMachine[1][2] === slotMachine[2][2]) { + this.displayElement.innerHTML += "
You have won on row 3!"; + } + } + checkDiagonalWinners(slotMachine) { + if (slotMachine[0][0] === slotMachine[1][1] && slotMachine[1][1] === slotMachine[2][2]) { + this.displayElement.innerHTML += "
You have won on diagonal down!"; + } + if (slotMachine[0][2] === slotMachine[1][1] && slotMachine[1][1] === slotMachine[2][0]) { + this.displayElement.innerHTML += "
You have won on diagonal up!"; + } + } + } + Casino.SlotsGame = SlotsGame; +})(Casino || (Casino = {})); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/js/app.js.map b/js/app.js.map new file mode 100644 index 00000000..548da3f1 --- /dev/null +++ b/js/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts","GameEngine.ts","GameEngineInterface.ts","GameInterface.ts","MainMenu.ts","Player.ts","PlayerInterface.ts","Profile.ts","SlotsGame.ts"],"names":[],"mappings":"AAAA,IAAU,MAAM,CAqBf;AArBD,WAAU,MAAM;IACZ,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,EAAC,CAAC,CAAQ,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IACzE;QAEW,MAAM,CAAC,eAAe;YACzB,IAAI,OAAO,GAAuC,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;YACxF,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;YAC/B,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;QACvB,CAAC;QAEM,MAAM,CAAC,QAAQ;YAClB,MAAM,CAAC,I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b/js/app.ts new file mode 100644 index 00000000..158ce87b --- /dev/null +++ b/js/app.ts @@ -0,0 +1,22 @@ +namespace Casino { + window.addEventListener("DOMContentLoaded",(e: Event) => loadMainMenu()); + export class Input { + private static userinput: string; + public static getInputFromBox() { + var element: HTMLInputElement = document.getElementById("user_input"); + this.userinput = element.value; + element.value = ""; + } + + public static getInput():string { + return this.userinput; + } + } + + document.getElementById("submit_button").addEventListener("click",(e: Event) => Input.getInputFromBox()); + + function loadMainMenu() { + var menu: MainMenu = new MainMenu(); + menu.menuStart(); + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..8a6385fb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compileOnSave": true, + "compilerOptions": { + "target": "es2015", + "noImplicitAny": false, + "sourceMap": true, + "watch": true, + "outFile": "js/app.js", + } +} \ No newline at end of file