001_Baddam_Krishna_Assignment_1 -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
                 CS536       Homework #1      CWID:A20193023 1A. a) Rules for the game beginning with any number of coins: Cond: take out 5 coins put back 1 coin   1)If all 5 coins are innocent put back one I coin                                     I,I,I,I,I -> I 2) If all 5 coins are Guilty put back one G coin                                    G,G,G,G,G -> G 3) If 4 are innocent and 1 is Guilty put back one G coin                                     I,I,I,I,G -> G 4) If 3 are innocent and 2 are Guilty put back one I coin                                I,I,I,G,G -> I 5) If 2 are innocent and 3 are Guilty put back one G coin I,I,G,G,G -> G 6) If 1is innocent and 4 are Guilty put back one I coin I,I,I,G,G -> I       b)        Input assertion:               If I is the no of coins of the type I and G is the no of coins of the type G, then  I+G = (4x+1) where x>0 With this input assertion it will make sure that the game is not terminated in between the  Execution since with this assertion the no of coins left over will be 5 in the end.         Output assertion:             The total number of coins remaining in the jar is equal to 1.        c)         Input assertion:                      If I is number of coins of the type I and G is the number of coins of the type G, then 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/04/2011 for the course CS 536 taught by Professor Cs536 during the Spring '08 term at Illinois Tech.

Page1 / 6

001_Baddam_Krishna_Assignment_1 -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online