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 com.mygdx.event; | |
import com.mygdx.manager.CurrentManager; | |
import com.mygdx.unit.Hero; | |
public class PartyRewardManager extends RewardManager { | |
private String NpcName = ""; | |
PartyRewardManager() { | |
NpcName = RewardManager.getInstance().getRewardKey().getKeyOfRewardValue(); |
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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Solution { | |
public static boolean[][] box; |
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 googlecodejam; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.Scanner; | |
public class Pylons2 { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); | |
int T = scan.nextInt(); |
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 Speed1 { | |
def main(args: Array[String]): Unit = { | |
var world = World() | |
world = world.newContainer() | |
world = world.addWater(0, 1.0) | |
world = world.newContainer() | |
world = world.connectTo(0, 1) | |
println(world.containers) | |
} | |
} |
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 speed2 | |
object Speed2 { | |
def main(args: Array[String]): Unit = { | |
var world = World() | |
world = world.newContainer() | |
world = world.addWater(0, 1.0) | |
world = world.newContainer() | |
world = world.connectTo(0, 1) | |
println(world.getAmount(0)) |
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 speed3 | |
object Speed3 { | |
def main(args: Array[String]): Unit = { | |
var world = World(Map( | |
"a" -> Container("a"), | |
"b" -> Container("b"), | |
"c" -> Container("c"), | |
"d" -> Container("d") | |
)) |
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 speed3 | |
import cats.data.State | |
import cats.implicits._ | |
case class World(containers: Map[String, Container]) | |
case class Container(parentKey: String, amount: Double, size: Int) | |
object Container { |
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 execise3 | |
case class World(grids: Map[String, Grid], appliances: Map[String, Appliance]) { | |
def newAppliance(id: String, powerAbsorbed: Int): World = this.copy( | |
appliances = this.appliances.updated(id, Appliance(powerAbsorbed, None, isOn = false)) | |
) | |
def newGrid(id: String, maxPower: Int): World = this.copy(grids = this.grids.updated(id, Grid(maxPower, maxPower))) | |
def plugInto(applianceId: String, gridId: String): Either[String, World] = { |
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 execise3 | |
import cats.data.{State, StateT} | |
import cats.implicits._ | |
case class World(grids: Map[String, Grid], appliances: Map[String, Appliance]) | |
object ops { | |
def newAppliance(id: String, powerAbsorbed: Int): State[World, Unit] = State.modify{ world => world.copy( | |
appliances = world.appliances.updated(id, Appliance(powerAbsorbed, None, isOn = false)) | |
)} |