verkel / noppabot

Noppabot, an IRC bot organizing a dice rolling contest
0 stars 0 forks source link

Poker Dealer can deal cards that are already on the table #10

Closed verkel closed 10 years ago

verkel commented 10 years ago

This happened:

15:45:02 @Dice-Ra "Today the common cards are:  K♠   J♣   8♣ . Anyone want to play?" 15:46:03 @Verkel deal 15:46:03 @Dice-Ra The Poker Dealer deals hand of  K♥   2♣  to Verkel! Verkel has a Pair of Kings!

18:00:00 @Dice-Ra I'll reveal tonight's turn card! 18:00:01 @Dice-Ra The poker table now contains:  K♠   J♣   8♣  +  10♣ 

20:06:00 @Dice-Ra A Poker Dealer appears! 20:06:01 @Dice-Ra "There's 2 seats left in the poker table", says the dealer. 20:06:02 @Dice-Ra "Today the common cards are:  K♠   J♣   8♣  +  10♣ . Anyone want to play?" 20:06:40 deal 20:06:40 @Dice-Ra The Poker Dealer deals hand of  4♥   3♠  to dazzt! dazzt has King High! 20:06:41 @Dice-Ra "There's still one seat left in the poker table", the dealer says. 20:44:47 @Verkel deal 20:45:54 @Verkel jaha, exception :)

22:00:01 @Dice-Ra The poker table now contains:  K♠   J♣   8♣  +  10♣  +  2♠  00:00:03 @Verkel roll 00:00:04 @Dice-Ra Verkel: sorry, I couldn't calculate value of your hand. :( It was:  Q♣   J♣ . Let's roll normal d100 instead.

Stacktracea:

java.lang.ArrayIndexOutOfBoundsException: -1
        at ca.ualberta.cs.poker.HandEvaluator.ID_KickerValueSuited(HandEvaluator.java:1019)
        at ca.ualberta.cs.poker.HandEvaluator.rankHand(HandEvaluator.java:1139)
        at noppabot.spawns.dice.PokerHand$HandRank.<init>(PokerHand.java:184)
        at noppabot.spawns.dice.PokerHand.getHandRank(PokerHand.java:115)
        at noppabot.spawns.instants.PokerDealer.onPickup(PokerDealer.java:92)
        at noppabot.NoppaBot.grabPowerup(NoppaBot.java:852)
        at noppabot.NoppaBot.handleMessage(NoppaBot.java:638)
        at noppabot.NoppaBot.onMessage(NoppaBot.java:553)
        at org.jibble.pircbot.PircBot.handleLine(PircBot.java:990)
        at org.jibble.pircbot.InputThread.run(InputThread.java:92)
java.lang.ArrayIndexOutOfBoundsException: -1
        at ca.ualberta.cs.poker.HandEvaluator.ID_KickerValueSuited(HandEvaluator.java:1019)
        at ca.ualberta.cs.poker.HandEvaluator.rankHand(HandEvaluator.java:1139)
        at noppabot.spawns.dice.PokerHand$HandRank.<init>(PokerHand.java:184)
        at noppabot.spawns.dice.PokerHand.getHandRank(PokerHand.java:115)
        at noppabot.PokerTable.getHandRank(PokerTable.java:191)
        at noppabot.PokerTable.listHands(PokerTable.java:164)
        at noppabot.PokerTable.revealRiver(PokerTable.java:136)
        at noppabot.PokerTable$RiverRevealTask.run(PokerTable.java:93)
        at it.sauronsoftware.cron4j.RunnableTask.execute(Unknown Source)
        at it.sauronsoftware.cron4j.TaskExecutor$Runner.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:744)
java.lang.ArrayIndexOutOfBoundsException: -1
        at ca.ualberta.cs.poker.HandEvaluator.ID_KickerValueSuited(HandEvaluator.java:1019)
        at ca.ualberta.cs.poker.HandEvaluator.rankHand(HandEvaluator.java:1139)
        at noppabot.spawns.dice.PokerHand$HandRank.<init>(PokerHand.java:184)
        at noppabot.spawns.dice.PokerHand.getHandRank(PokerHand.java:115)
        at noppabot.PokerTable.getHandRank(PokerTable.java:191)
        at noppabot.PokerTable.listHands(PokerTable.java:164)
        at noppabot.NoppaBot.handleMessage(NoppaBot.java:632)
        at noppabot.NoppaBot.onMessage(NoppaBot.java:553)
        at org.jibble.pircbot.PircBot.handleLine(PircBot.java:990)
        at org.jibble.pircbot.InputThread.run(InputThread.java:92)
java.lang.ArrayIndexOutOfBoundsException: -1
        at ca.ualberta.cs.poker.HandEvaluator.ID_KickerValueSuited(HandEvaluator.java:1019)
        at ca.ualberta.cs.poker.HandEvaluator.rankHand(HandEvaluator.java:1139)
        at noppabot.spawns.dice.PokerHand$HandRank.<init>(PokerHand.java:184)
        at noppabot.spawns.dice.PokerHand.onContestRoll(PokerHand.java:78)
        at noppabot.NoppaBot.rollAndParticipate(NoppaBot.java:899)
        at noppabot.NoppaBot.handleMessage(NoppaBot.java:600)
        at noppabot.NoppaBot.onMessage(NoppaBot.java:553)
        at org.jibble.pircbot.PircBot.handleLine(PircBot.java:990)
        at org.jibble.pircbot.InputThread.run(InputThread.java:92)
verkel commented 10 years ago

Was caused by Deck#shuffle() resetting the drawn cards of the deck. Should be fixed now.