program mindread; var cards, card, range, span, yon, color, suit: string; procedure response(var yon: string); var str: string; begin readln(str); if pos(' ', str) <> 0 then yon := 'yes' else yon := 'no'; end; begin cards := ''; writeln('Is subject concentrating?'); response(yon); if yon = 'yes' then begin color := 'black'; writeln('1. Is the card a black card?'); response(yon); if yon = 'yes' then begin suit := 'clubs'; writeln('2. Is it a club?'); end else begin suit := 'spades'; writeln('2. Is it a spade?'); end; end else begin color := 'red'; writeln('1. Is the card a red card?'); response(yon); if yon = 'yes' then begin suit := 'diamonds'; writeln('2. Is is a diamond?'); end else begin suit := 'hearts'; writeln('2. Is is a heart?'); end; end; response(yon); if yon = 'yes' then begin range := 'high'; writeln('3. Is card higher than 9?'); response(yon); if yon = 'yes' then begin span := 'AK'; writeln('4. Is card ace or king?'); response(yon); if yon = 'yes' then card := 'ace' else card := 'King'; end else begin span := 'QJ10'; writeln('4. Is card queen, jack, or 10?'); response(yon); if yon = 'yes' then begin cards := 'QJ'; writeln('5. Is it a picture card?'); response(yon); if yon = 'yes' then card := 'queen' else card := 'jack'; end else card := '10'; end; end else begin range := 'low'; writeln('3. Is card lower than 10?'); response(yon); if yon = 'yes' then begin span := '9-6'; writeln('4. Is card greater than 5?'); response(yon); if yon = 'yes' then begin cards := '98'; writeln('5. Is card 9 or 8?'); response(yon); if yon = 'yes' then card := '9' else card := '8'; end else begin cards := '76'; writeln('5. Is card 7 or 6?'); response(yon); if yon = 'yes' then card := '7' else card := '6'; end; end else begin span := '5-2'; writeln('4. Is card less than 6?'); response(yon); if yon = 'yes' then begin cards := '54'; writeln('5. Is card 5 or 4?'); response(yon); if yon = 'yes' then card := '5' else card := '4'; end else begin cards := '32'; writeln('5. Is card 3 or 2?'); response(yon); if yon = 'yes' then card := '3' else card := '2'; end; end; end; writeln('Card is ', card, ' of ', suit); readln; end.