Last active
August 29, 2015 14:10
-
-
Save kozake/c713f6b878ee8e50f184 to your computer and use it in GitHub Desktop.
しょぼちむ Advent Calendar 2014 のソース(支払い)
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
package syobochim; | |
import java.math.BigDecimal; | |
import java.util.stream.Stream; | |
public enum 支払い { | |
おごるよ, ごちになります, 割り勘; | |
public static Stream<可能性<支払い>> どうする( | |
可能性<しょぼちむ> しょぼちむの正体) { | |
BigDecimal 確率 = しょぼちむの正体.確率; | |
switch (しょぼちむの正体.選択肢) { | |
case バイトの女の子: | |
// かわいい!! | |
return Stream.of( | |
可能性.create(おごるよ | |
, new BigDecimal("0.9").multiply(確率)) | |
, 可能性.create(割り勘 | |
, new BigDecimal("0.1").multiply(確率)) | |
); | |
case ようおっさん: | |
// おっさん乙 | |
return Stream.of( | |
可能性.create(ごちになります | |
, new BigDecimal("0.9").multiply(確率)) | |
, 可能性.create(割り勘 | |
, new BigDecimal("0.1").multiply(確率)) | |
); | |
case 二年目女子SE: | |
// 若い!! | |
return Stream.of( | |
可能性.create(おごるよ | |
, new BigDecimal("0.7").multiply(確率)) | |
, 可能性.create(割り勘 | |
, new BigDecimal("0.3").multiply(確率)) | |
); | |
case まじレッドキング: | |
// おごるどうこうの問題ではない | |
return Stream.empty(); | |
default: | |
// お前誰だ? | |
return Stream.of( | |
可能性.create(割り勘 | |
, new BigDecimal("1.0").multiply(確率)) | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment