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

CS 341 Homework 3 Answers Chapter 5 2) Show a DFSM to accept each of the following languages: b) { w { a , b }* : w does not end in ba }. a 2 1 b 3 4 b c) { w { 0 , 1 }* : w corresponds to the binary encoding, without leading 0’s, of natural numbers that are evenly divisible by 4}. d) { w { 0 , 1 }* : w corresponds to the binary encoding, without leading 0’s, of natural numbers that are powers of 4}. 0 1 0 g) { w { 0 , 1 }* : w does not have 001 as a substring}. l) The set of binary strings with at most one pair of consecutive 0’s and at most one pair of consecutive 1’s.

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

View Full Document
3) Consider the children’s game Rock, Paper, Scissors h. We’ll say that the first player to win two rounds wins the game. Call the two players A and B . a) Define an alphabet Σ and describe a technique for encoding Rock, Paper, Scissors games as strings over Σ . (Hint: each symbol in Σ should correspond to an ordered pair that describes the simultaneous actions of A and B .) Let Σ have 9 characters. We’ll use the symbols a - i to correspond to the following events. Let the first element of each pair be A’s move. The second element of each pair will be B’s move. a b c d e f g h i R, R R, P R, S P, P P, R P, S S, S S, P S, R A Rock, Paper, Scissors game is a string of the symbols a - i . We’ll allow strings of arbitrary length, but once one player as won two turns, no further events affect the outcome of the match.
This is the end of the preview. Sign up to access the rest of the document.