Comment detail

ポーカーの役判定 (Nested Flatten)

This comment is reply for 5156 yuin: パターンマッチって素晴らしい。(ポーカーの役判定). Go to thread root.

すみません、1箇所ミスってました。

1
2
3
4
5
6
7
8
9
@@ -8,7 +8,7 @@
       case _ => false
     }
     val flush_? = cs.forall(cs(0)._1 == _._1)
-    val st_? = (1 to 9).map(i=>cs(0)._2==i && cs(4)._2==i+4).exists(true==) || royalSt_?
+    val st_? = (1 to 9).map(i=>(0 to 4).forall(j=>cs(j)._2==i+j)).exists(true==) || royalSt_?
     val p = (((List(List[(char,int)]())) /: List.make(2, cs)){
               for(i <-_; j <-_) yield j::i
             }.filter(c=>c(0)._2 == c(1)._2).size - 5)/2

Index

Feed

Other

Link

Pathtraq

loading...