Unix Assignment 4

ehstudent

Need assistance in completing a Unix  Scripting assignment. The assignment asks to write 2 scripts

 

That's quite an impressive script for the card problem.  However, I did find some issues
when I replaced the random card generator with explicit values, to test some of the
scenarios.  For example, I set a straight flush and a full house, yet it did not recognize
the straight flush and reported the full house as a four of a kind.

You may want to try some test data, to confirm that all the tests work as expected.

Regards,
Ed

#code modification for testing
# hand1=${unique[@]:0:5}  # put the first 5 element as hand 1
hand1=( 10.0 11.0 12.0 13.0 14.0 )
# hand2=${unique[@]:5}
hand2=( 9.0 10.1 10.2 10.3 9.2 )


Output:

==============================

=======-=================
 Hands are noted with a decimal number like this: 9.2
 It means 9 of Hearts.
 Suites ranking : Diamonds(0) , Clubs(1), Hearts(2), Spades(3)
Denominations: 2 to 10 , 11=Jack, 12=Queen, 13=King, 14=Ace
=====================================-=================
=====================================-=================
hand 1: 10.0 11.0 12.0 13.0 14.0
hand 2: 9.0 9.2 10.1 10.2 10.3
=====================================-=================
No straight flush for both hands
No Four of a kind for both hands
Hand 2 wins: Four of a kind
  • 13 years ago
  • 9
Answer(1)

Purchase the answer to view it

  • randomdeck.zip
  • randomdeck_corrected.zip
Bids(0)