User:Saatwik Katiha/personal sandbox
package com.saatwik.TestBlock;
public class Logic1 {
public boolean cigarParty(int cigars, boolean isWeekend) { if (isWeekend) return (cigars >= 40); return cigars >= 40 && cigars <= 60; }
public int dateFashion(int you, int date) { if (you <= 2 || date <= 2) return 0; return (you >= 8 && date >= 2 || date >= 8 && you >= 2) ? 2 : 1; }
public boolean squirrelPlay(int temp, boolean isSummer) { return (isSummer) ? (temp >= 60 && temp <= 100) : (temp >= 60 && temp <= 90); }
public int caughtSpeeding(int speed, boolean isBirthday) { if (isBirthday) speed -= 5; if (speed <= 60) return 0; return (speed > 60 && speed <= 80) ? 1 : 2; }
public int sortaSum(int a, int b) { return (a + b >= 10 && a + b <= 19) ? 20 : a + b; }
public String alarmClock(int day, boolean vacation) {
if (vacation) return (day >= 1 && day <= 5) ? "10:00" : "off"; return (day >= 1 && day <= 5) ? "7:00" : "10:00"; }
public boolean love6(int a, int b) { return a == 6 || b == 6 || a + b == 6 || Math.abs(a - b) == 6; }
public boolean in1To10(int n, boolean outsideMode) { return (outsideMode) ? n <= 1 || n >= 10 : n >= 1 && n <= 10; }
public boolean nearTen(int num) { return num % 10 >= 8 || num % 10 <= 2; }
public int teenSum(int a, int b) { return (a >= 13 && a <= 19 || b >= 13 && b <= 19) ? 19 : a + b; }
public boolean answerCell(boolean isMorning, boolean isMom, boolean isAsleep) { if (isAsleep) return false; if (isMorning) return isMom; return true; }
public int teaParty(int tea, int candy) { if (candy < 5 || tea < 5) return 0; if (candy >= 5 && tea >= 5 && (candy >= 2 * tea || tea >= 2 * candy)) return 2; return 1; }
public boolean twoAsOne(int a, int b, int c) { return a + b == c || a + c == b || b + c == a; }
public boolean inOrder(int a, int b, int c, boolean bOk) { if (bOk) return b < c; return a < b && b < c; }
public boolean inOrderEqual(int a, int b, int c, boolean equalOk) { if (equalOk) return a <= b && b <= c; return a < b && b < c; }
public boolean lastDigit(int a, int b, int c) { return a % 10 == b % 10 || a % 10 == c % 10 || b % 10 == c % 10; }
public boolean lessBy10(int a, int b, int c) { return Math.abs(a - c) >= 10 || Math.abs(a - b) >= 10 || Math.abs(b - c) >= 10; }
public int withoutDoubles(int die1, int die2, boolean noDoubles) { if (!noDoubles) return die1 + die2; if (die1 == die2) return (die1 != 6) ? die1 + die2 + 1 : die1 + 1; return die1 + die2; }
public int maxMod5(int a, int b) { if (a == b) return 0; if (a % 5 == b % 5) return (a < b) ? a : b; return (a < b) ? b : a; }
public int redTicket(int a, int b, int c) { if (a == b && b == c) return (c == 2) ? 10 : 5; if (a != b && a != c) return 1; return 0; }
public boolean makeBricks(int small, int big, int goal) { return goal - big * 5 <= small && goal % 5 <= small; }
public int loneSum(int a, int b, int c) { if (a == b && b == c) return 0; if (a == b) return c; if (a == c) return b; if (b == c) return a; return a + b + c; }
public int luckySum(int a, int b, int c) { if (a == 13) return 0; if (b == 13) return a; if (c == 13) return a + b; return a + b + c; }
public int noTeenSum(int a, int b, int c) { return fixTeen(a) + fixTeen(b) + fixTeen(c); }
public int fixTeen(int n) { return (n >= 13 && n < 15 || n > 16 && n <= 19) ? 0 : n; }
public int roundSum(int a, int b, int c) { return round10(a) + round10(b) + round10(c); }
public int round10(int num) { return (num % 10 < 5) ? (num / 10 * 10) : (num / 10 * 10 + 10); }
public boolean closeFar(int a, int b, int c) { if (Math.abs(b - c) < 2) return false; return Math.abs(a - b) <= 1 && Math.abs(a - c) >= 2 || Math.abs(a - c) <= 1 && Math.abs(a - b) >= 2; }
public int blackjack(int a, int b) { if (a > 21 && b > 21) return 0; if (a > 21 && b <= 21) return b; if (a <= 21 && b > 21) return a; return Math.max(a, b); }
public boolean evenlySpaced(int a, int b, int c) { int min = Math.min(Math.min(a, b), c); int mid = Math.max(Math.min(a, b), c); int mid2 = Math.min(Math.max(a, b), c); int max = Math.max(Math.max(a, b), c); return Math.abs(mid - min) == Math.abs(mid - max) || Math.abs(mid2 - min) == Math.abs(mid2 - max); }
public int makeChocolate(int small, int big, int goal) { int maxBig = goal / 5; if (big > maxBig) return (goal <= 5 * maxBig + small) ? (goal - 5 * maxBig) : -1; return (goal <= 5 * big + small) ? (goal - 5 * big) : -1; } }