RosettaCodeData/Task/Dinesmans-multiple-dwelling.../IS-BASIC/dinesmans-multiple-dwelling...

20 lines
1.0 KiB
Plaintext

100 PROGRAM "Dinesman.bas"
110 PRINT "Floors are numbered 0 (ground) to 4 (top).":PRINT "Baker, Cooper, Fletcher, Miller, and Smith live on different floors."
120 PRINT "- Baker does not live on the top floor.":PRINT "- Cooper does not live on the bottom floor."
130 PRINT "- Fletcher does not live on either the top or the bottom floor.":PRINT "- Miller lives on a higher floor than does Cooper."
140 PRINT "- Smith does not live on a floor adjacent to Fletcher's.":PRINT "- Fletcher does not live on a floor adjacent to Cooper's.":PRINT :LET S$=" lives on floor"
150 FOR B=0 TO 3
150 FOR C=1 TO 4
170 FOR F=1 TO 3
180 FOR M=0 TO 4
190 FOR S=0 TO 4
200 IF B<>C AND B<>F AND B<>M AND B<>S AND C<>F AND C<>M AND C<>S AND F<>M AND F<>S AND M<>S AND M>C AND ABS(S-F)<>1 AND ABS(F-C)<>1 THEN
210 PRINT "Baker",S$;B:PRINT "Cooper",S$;C:PRINT "Fletcher";S$;F:PRINT "Miller",S$;M:PRINT "Smith",S$;S
220 END
230 END IF
240 NEXT
250 NEXT
260 NEXT
270 NEXT
280 NEXT