Archive for January 5th, 2009

N queens solution with erlang

Monday, January 5th, 2009

8queens

“The eight queens puzzle is the problem of putting eight chess queens on an 8×8 chessboard such that none of them is able to capture any other using the standard chess queen’s moves. The queens must be placed in such a way that no two queens would be able to attack each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n queens puzzle of placing n queens on an n×n chessboard, where solutions exist only for n = 1 or n ≥ 4… ” [Wikipedia]

Below my solution using ERLANG (very strong for concurrent programming, used by Ericsson, Facebook, Amazon,Google,..) with List comprehensions and suggestions from other sites

(more…)

Lawyer

Monday, January 5th, 2009

* Lawyer: “Doctor, before you performed the autopsy, did you check for a pulse?”
* Witness: “No.”
* Lawyer: “Did you check for blood pressure?”
* Witness: “No.”
* Lawyer: “Did you check for breathing?”
* Witness: “No.”
* Lawyer: “So, then it is possible that the patient was alive when you began the autopsy?”
* Witness: “No.”
* Lawyer: “How can you be so sure, Doctor?”
* Witness: “Because his brain was sitting on my desk in a jar.”
* Lawyer: “But could the patient have still been alive nevertheless?”
* Witness: “Yes, it is possible that he could have been alive and practicing law somewhere.”