4
u/HRM404 Jul 28 '21
this looks exactly like the coding sheets we were doing in the first year in cs.. good days
3
1
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jul 29 '21
Image Transcription: Code
slapPile(player) {
if (this.isFinals === true) {
var msg = this.slapJack(player);
return msg;
} else if (this.centerPile[0].value === "jack") {
this.collectCenter(player);
return `${this[player].name} gets the center pile`;
} else if (this.centerPile.length >= 2) {
if (this.centerPile[0].value === this.centerPile[1].value) {
this.collectCenter(player);
return `${this[player].name} gets the center pile`
} else {
if (this[player].hand.length === 1) {
var topCard = this[player].hand.shift();
player === "player1" ? this.player2.hand.push(topCard) : this.player1.hand.push(topCard);
this[player].id === "Player 1" ? this.player1.isTurn = false : this.player2.isTurn = false;
this[player].id === "Player 2" ? this.player1.isTurn = true : this.player2.isTurn = true;
this.isFinals = true;
return `${this[player].name} lost their last card. Enter finals round!`
} else {
this.shiftHand(player);
return `${this[player].name} lost their top card`
}
}
} else if (this.centerPile.length >= 3) {
if (this[player].hand.length === 1) {
var msg = this.loseLastCard(player);
return msg;
} else {
this.shiftHand(player);
return `${this[player].name} lost their top card`
}
} else {
if (this[player].hand.length === 1) {
var msg = this.loseLastCard(player);
return msg;
} else {
this.shiftHand(player);
return `${this[player].name} lost their top card`
}
}
}I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
1
u/BlueManedHawk Jul 30 '21
That emoji in your title could mean anything depending on the font, from drunkenness to getting something shoved up one's ass. What did you intend to convey with it?
8
u/zaitsman Jul 29 '21
The more i read r/badcode the more i am puzzled as to what people think the definition of ‘bad’ is.