All pastes #770573 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-12 12:12 UTC
rendered paste body
	(let ((facelist) (countlist) (j 2) (combolist))
		(mapcar #'(lambda (card) (push (second card) facelist)) hand)
		
		(loop for i from 2 to 14 do
			(push (count i facelist) countlist)
		)
	
		(dolist (elem (reverse countlist))
			; One pair, two pair, three pair (:P), three of a kind, four of a kind
			(if (or (or (= elem 2) (= elem 3)) (= elem 4))
				(loop for i from 0 to (- (length facelist) 1)
					when (= (nth i (reverse facelist)) j) 
					do (push (nth i hand) combolist)
				)
			)
			; Full house
			(if (and (= elem 2) (= elem 3))
				(loop for i from 0 to (- (length facelist) 1)
					when (= (nth i (reverse facelist)) j) 
					do (push (nth i hand) combolist)
				)
			)

			(incf j)
		)