001_KANDASAMY_VIGGNESH_01

# 001_KANDASAMY_VIGGNESH_01 - Science of Programming...

This preview shows pages 1–3. Sign up to view the full content.

Science of Programming Assignment #1 Name:Viggnesh Kandasamy Date: Sep. 3rd, 2008 CWID:10458478 Question –1 1 a) Game rules for games that begin with any number of coins. (take out five coins and return one) { Out In PPPPP P PPPPF F PPPFF P PPFFF F PFFFF P FFFFF F } { When there is odd number of P’s its always a win (or) pass and in case of even number of P’s a fail would always be generated. } 1 b) The input assertion and output assertion that will guarantee only that the game will always terminate. For the game to be terminated it must have a single constant at the end of the final round. Input Assertion: { P 0 and F 0 and (P+L) 5+4num } num = { 0,1,2,3. ..} Where 4num can be any natural number. (P+L) (5+4num) is the condition that ensures that the player always terminates the game in any number of rounds.

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

View Full Document
Science of Programming Assignment #1 Name:Viggnesh Kandasamy Date: Sep. 3rd, 2008 CWID:10458478 Output Assertion: The output assertion indicates the output condition. {P 0 or F 0 and (P + F)=1} When the number of pass and fail adds to one it means that the game has been terminated. 1 c) The input assertion and output assertion that would guarantee that the student would always pass. Input Assertion: { P 0 and F 0 and (Odd(P)+L) 5+4num } num = { 0,1,2,3. ..} Any student would always win (or) pass when there are odd number of P’s. Hence using this input assertion we conclude that the player would always win. Output Assertion:
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 / 10

001_KANDASAMY_VIGGNESH_01 - Science of Programming...

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

View Full Document
Ask a homework question - tutors are online