diff --git a/app/Player.js b/app/Player.js new file mode 100644 index 00000000..e69de29b diff --git a/app/Player.ts b/app/Player.ts new file mode 100644 index 00000000..e69de29b diff --git a/app/PlayerInterface.js b/app/PlayerInterface.js new file mode 100644 index 00000000..e69de29b diff --git a/app/PlayerInterface.ts b/app/PlayerInterface.ts new file mode 100644 index 00000000..9e2fc42b --- /dev/null +++ b/app/PlayerInterface.ts @@ -0,0 +1,6 @@ +interface PlayerInterface +{ + profileName : string; + id : string; + name : string; +} \ No newline at end of file diff --git a/app/Profile.js b/app/Profile.js new file mode 100644 index 00000000..0c71f535 --- /dev/null +++ b/app/Profile.js @@ -0,0 +1,8 @@ +var Profile = /** @class */ (function () { + function Profile(id, name, balance) { + this.balance = balance; + this.id = id; + this.name = name; + } + return Profile; +}()); diff --git a/app/Profile.ts b/app/Profile.ts new file mode 100644 index 00000000..551c0f21 --- /dev/null +++ b/app/Profile.ts @@ -0,0 +1,13 @@ +class Profile +{ + id : number; + name : string; + balance : number; + + constructor(id : number, name : string, balance : number) + { + this.balance = balance; + this.id = id; + this.name = name; + } +} \ No newline at end of file diff --git a/app/app.js b/app/app.js new file mode 100644 index 00000000..7e5278a4 --- /dev/null +++ b/app/app.js @@ -0,0 +1,106 @@ +var UserInterface = /** @class */ (function () { + function UserInterface() { + var _this = this; + this.userInput = document.getElementById('user_input'); + this.window = document.getElementById('display'); + this.button = document.getElementById('submit'); + this.button.addEventListener("click", function (e) { _this._lastInput = _this.userInput.value; }); + this.button.addEventListener("click", function (e) { return console.log(_this._lastInput); }); + this.button.addEventListener("click", function (e) { _this.userInput.value = ''; }); + } + UserInterface.prototype.display = function (input) { + this.window.innerText += input + '\n'; + }; + UserInterface.prototype.clear = function () { + this.window.innerText = ''; + }; + UserInterface.prototype.lastInput = function () { + return this._lastInput; + }; + UserInterface.prototype.start = function () { + var _this = this; + this.display("Choose a game by entering it in the text field below and then click submit"); + this.button.addEventListener("click", function (e) { return _this.chooseGame(); }); + }; + UserInterface.prototype.chooseGame = function () { + if (this.lastInput() === "Blackjack" || this.lastInput() === "blackjack") { + this.clear(); + this.display("Ok, get ready to lose son!"); + } + else { + this.clear(); + this.display("Good, you were gonna lose anyway!"); + } + }; + return UserInterface; +}()); +var MathOps = /** @class */ (function () { + function MathOps() { + } + MathOps.sum = function (number1, number2) { + return (number1 + number2); + }; + return MathOps; +}()); +var SuitString; +(function (SuitString) { + SuitString["CLUBS"] = "clubs"; + SuitString["DIAMONDS"] = "diamonds"; + SuitString["HEARTS"] = "hearts"; + SuitString["SPADES"] = "spades"; +})(SuitString || (SuitString = {})); +var SuitSymbol; +(function (SuitSymbol) { + SuitSymbol["CLUBS"] = "\u2663"; + SuitSymbol["DIAMONDS"] = "\u2666"; + SuitSymbol["HEARTS"] = "\u2665"; + SuitSymbol["SPADES"] = "\u2660"; +})(SuitSymbol || (SuitSymbol = {})); +var RankNumber; +(function (RankNumber) { + RankNumber[RankNumber["DEUCE"] = 2] = "DEUCE"; + RankNumber[RankNumber["THREE"] = 3] = "THREE"; + RankNumber[RankNumber["FOUR"] = 4] = "FOUR"; + RankNumber[RankNumber["FIVE"] = 5] = "FIVE"; + RankNumber[RankNumber["SIX"] = 6] = "SIX"; + RankNumber[RankNumber["SEVEN"] = 7] = "SEVEN"; + RankNumber[RankNumber["EIGHT"] = 8] = "EIGHT"; + RankNumber[RankNumber["NINE"] = 9] = "NINE"; + RankNumber[RankNumber["TEN"] = 10] = "TEN"; + RankNumber[RankNumber["JACK"] = 11] = "JACK"; + RankNumber[RankNumber["QUEEN"] = 12] = "QUEEN"; + RankNumber[RankNumber["KING"] = 13] = "KING"; + RankNumber[RankNumber["ACE"] = 1] = "ACE"; +})(RankNumber || (RankNumber = {})); +var RankString; +(function (RankString) { + RankString["DEUCE"] = "2"; + RankString["THREE"] = "3"; + RankString["FOUR"] = "4"; + RankString["FIVE"] = "5"; + RankString["SIX"] = "6"; + RankString["SEVEN"] = "7"; + RankString["EIGHT"] = "8"; + RankString["NINE"] = "9"; + RankString["TEN"] = "10"; + RankString["JACK"] = "J"; + RankString["QUEEN"] = "Q"; + RankString["KING"] = "K"; + RankString["ACE"] = "A"; +})(RankString || (RankString = {})); +var Card = /** @class */ (function () { + function Card(suitSymbol, rankNumber, rankString) { + this.suitSymbol = suitSymbol; + this.rankNumber = rankNumber; + this.rankString = rankString; + } + Card.prototype.getSuitSymbol = function () { return this.suitSymbol; }; + Card.prototype.getRankNumber = function () { return this.rankNumber; }; + Card.prototype.getRankString = function () { return this.rankString; }; + Card.prototype.toString = function () { + return this.suitSymbol + this.rankString; + }; + return Card; +}()); +var UI = new UserInterface; +UI.start(); diff --git a/app/app.ts b/app/app.ts new file mode 100644 index 00000000..5e749a21 --- /dev/null +++ b/app/app.ts @@ -0,0 +1,147 @@ +class UserInterface +{ + public userInput: HTMLInputElement = document.getElementById('user_input'); + public window: HTMLDivElement = document.getElementById('display') + public button: HTMLDivElement = document.getElementById('submit'); + public _lastInput : any; + + constructor() + { + this.button.addEventListener("click", (e: Event) => {this._lastInput = this.userInput.value}); + this.button.addEventListener("click", (e: Event) => console.log(this._lastInput)); + this.button.addEventListener("click", (e:Event) => {this.userInput.value = ''}); + } + + display(input: string): void + { + this.window.innerText += input + '\n'; + } + + clear(): void + { + this.window.innerText = ''; + } + + lastInput(): any + { + return this._lastInput; + } + + start() + { + this.display("Choose a game by entering it in the text field below and then click submit"); + this.button.addEventListener("click", (e:Event) => this.chooseGame()); + } + + chooseGame(): void + { + if (this.lastInput() === "Blackjack" || this.lastInput() === "blackjack") + { + this.clear(); + this.display("Ok, get ready to lose son!"); + } + else + { + this.clear(); + this.display("Good, you were gonna lose anyway!"); + } + } + + +} + +class MathOps +{ + constructor() {} + + static sum(number1: number, number2: number): number + { + return (number1 + number2); + } + +} + +enum SuitString { + CLUBS = "clubs", + DIAMONDS = "diamonds", + HEARTS = "hearts", + SPADES = "spades" +} + +enum SuitSymbol +{ + CLUBS = "\u2663", + DIAMONDS = "\u2666", + HEARTS = "\u2665", + SPADES = "\u2660" +} + +enum RankNumber +{ + DEUCE = 2, + THREE = 3, + FOUR = 4, + FIVE = 5, + SIX = 6, + SEVEN = 7, + EIGHT = 8, + NINE = 9, + TEN = 10, + JACK = 11, + QUEEN = 12, + KING = 13, + ACE = 1 +} + +enum RankString +{ + DEUCE = "2", + THREE = "3", + FOUR = "4", + FIVE = "5", + SIX = "6", + SEVEN = "7", + EIGHT = "8", + NINE = "9", + TEN = "10", + JACK = "J", + QUEEN = "Q", + KING = "K", + ACE = "A" +} + +class Card +{ + private suitSymbol: SuitSymbol; + private rankNumber: RankNumber; + private rankString: RankString; + + + constructor(suitSymbol : SuitSymbol, rankNumber: RankNumber, rankString: RankString ) + { + this.suitSymbol = suitSymbol; + this.rankNumber = rankNumber; + this.rankString = rankString; + } + + getSuitSymbol(): string { return this.suitSymbol; } + getRankNumber(): number { return this.rankNumber; } + getRankString(): string { return this.rankString; } + + toString(): string + { + return this.suitSymbol + this.rankString; + } + + +} + +let UI: UserInterface = new UserInterface; +UI.start(); + + + + + + +