This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CityInfoContentItem { | |
private int type; | |
// type header - 0 | |
private String headerText; | |
// type phrase - 1 | |
private String extraInfo; | |
private String phrase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MockMiniMax { | |
def mockEval(state: MockState): Int = state match { | |
case MockState(List(false,false,false,false)) => 8 | |
case MockState(List(true,false,false,false)) => 7 | |
case MockState(List(false,true,false,false)) => 3 | |
case MockState(List(true,true,false,false)) => 9 | |
case MockState(List(false,false,true,false)) => 9 | |
case MockState(List(true,false,true,false)) => 8 | |
case MockState(List(false,true,true,false)) => 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----- pid 1479 at 2016-05-31 15:27:30 ----- | |
Cmd line: com.android.phone | |
Build fingerprint: 'google/razor/flo:6.0.1/MOB30J/2775141:user/release-keys' | |
ABI: 'arm' | |
Build type: optimized | |
Zygote loaded classes=3978 post zygote classes=394 | |
Intern table: 45424 strong; 33 weak | |
JNI: CheckJNI is off; globals=352 (plus 362 weak) | |
Libraries: /system/lib/libandroid.so /system/lib/libcompiler_rt.so /system/lib/libjavacrypto.so /system/lib/libjnigraphics.so /system/lib/libmedia_jni.so /system/lib/libwebviewchromium_loader.so libjavacore.so (7) | |
Heap: 5% free, 12MB/13MB; 137224 objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Action1<Throwable> crashOnError() { | |
final Throwable checkpoint = new Throwable(); | |
return throwable -> { | |
StackTraceElement[] stackTrace = checkpoint.getStackTrace(); | |
StackTraceElement element = stackTrace[1]; // First element after `crashOnError()` | |
String msg = String.format("onError() crash from subscribe() in %s.%s(%s:%s)", | |
element.getClassName(), | |
element.getMethodName(), | |
element.getFileName(), | |
element.getLineNumber()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Exp { | |
def eval: Int | |
} | |
case class Oper(op: (Int, Int) => Int, left: Exp, right: Exp) extends Exp { | |
override def eval: Int = op(left.eval, right.eval) | |
} | |
case class Num(value: Int) extends Exp { | |
override def eval: Int = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hand { | |
public final Card firstCard; | |
public final Card secondCard; | |
public Hand(Card firstCard, Card secondCard) { | |
this.firstCard = firstCard; | |
this.secondCard = secondCard; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- print given tree | |
main = putStrLn (treeToSring (tree 4 2 3)) | |
-- concatenate string from tree list structure | |
treeToSring treeList = intercalate "" [ unlines block | block <- treeList] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- creates tree in list structure | |
tree bc gf fbs = [block rows (treeMaxSp bc gf fbs) | rows <- take bc [fbs,(fbs+gf)..]] | |
-- counts maximal number of spaces for given tree | |
treeMaxSp bc gf fbs = ((bc-1)*gf)+(fbs-1) | |
-- creates one block with specified number of rows and maximal space | |
block rowCount maxSp = [row st sp | (st,sp) <- take rowCount (zip [1,3..] [maxSp,maxSp-1..0])] | |
-- creates one row with specified number of stars and spaces |