Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

programming exercises

Name: Anonymous 2011-06-25 16:53

In a language of your choice, solve...

"Baker, Cooper, Fletcher, Miller, and Smith live on different floors of an apartment house that contains only five floors. Baker does not live on the top floor. Cooper does not live on the bottom floor. Fletcher does not live on either the top or the bottom floor. Miller lives on a higher floor than does Cooper. Smith does not live on a floor adjacent to Fletcher's. Fletcher does not live on a floor adjacent to Cooper's. Where does everyone live?"


And be sure to post your own programming exercises.

Name: Anonymous 2011-06-25 17:01

In ur anus,

Name: Anonymous 2011-06-25 17:30

Name: Anonymous 2011-06-26 5:13

>>3
Beautiful!

Name: Anonymous 2011-06-26 7:13

>>3
Yeah, this looks handy.

Name: Anonymous 2011-06-26 9:56

import itertools

for floors in itertools.permutations(range(1, 6)):
    b, c, f, m, s = floors
    bad = {b == 5, c == 1, f in {1, 5}, m < c,
           abs(f-s) == 1, abs(f-c) == 1}
    if any(bad): continue
    print("Baker: {}, Cooper: {}, Fletcher: {}, "
          "Miller: {}, Smith: {}.".format(b,c,f,m,s))

Name: Anonymous 2011-06-26 10:30

>>3
I came

Name: Anonymous 2011-06-26 10:59

Chicken is only an elaborate solution to the last exercise of SICP.

Name: Anonymous 2011-06-26 11:40

I remember reading about amb in THE BOOK.

Name: Anonymous 2011-06-26 14:30

Hijacking this thread.

If Chicken Scheme is so good, why do people use SBCL?

Name: Anonymous 2011-06-26 15:14

>>10
Because SBCL is Common Lisp, and Chicken Scheme is a Scheme.

LISP is for fags anyway.

Name: Anonymous 2011-06-26 19:08

this looks like a job for PROLOG!

Name: Anonymous 2011-06-26 19:14

NOOBLOG

Name: Anonymous 2011-06-26 20:59

Name: Anonymous 2011-06-27 11:05

>>14
faggot language

Don't change these.
Name: Email:
Entire Thread Thread List