This file contains hidden or 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
| abstract class FootMan { | |
| def attack(n: FootMan) = { | |
| n.attackedBy(this) | |
| } | |
| def attack(n: Building) | |
| var hp:Int | |
| var damage:Int | |
| var arm:Int | |
| def attakedBy(n: FootMan) | |
| } |
This file contains hidden or 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
| val l = List(1,2,3,4) | |
| val l2 = List(5,6,7) | |
| def length[T](l:List[T]):Int = l match { | |
| case Nil => 0 | |
| case x :: xs => 1 + length(xs) | |
| } | |
| length(l) == 4 | |
| //последний элемент списка |
This file contains hidden or 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
| akka { | |
| actor { | |
| provider = "akka.remote.RemoteActorRefProvider" | |
| deployment { | |
| /Masha { | |
| remote = "akka.tcp://TestSystem@127.0.0.1:2553/user/Masha" | |
| } | |
| } | |
| } | |
| remote { |
This file contains hidden or 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
| name := "SBTTest" | |
| scalaVersion := "2.11.7" | |
| libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.11" | |
| libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.3.11" |
This file contains hidden or 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 akka.actor._ | |
| class Misha extends Actor { | |
| override def receive = { | |
| case "Start" => { | |
| val masha = | |
| context.system.actorSelection("user/Masha") | |
| masha ! "Hello" | |
| } | |
| case "GoodBye" => println(":((") |
This file contains hidden or 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
| class Rational(val num:Int, val denum:Int) { | |
| def +(that:Rational) = | |
| new Rational(num*that.denum + that.num*denum, denum*that.denum) | |
| def *(that:Rational) = | |
| new Rational(num*that.num, denum*that.denum) | |
| override def toString = num + "/" + denum | |
| //def minus(that:Rational) = { |
This file contains hidden or 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
| //реализовать закоментированные функции | |
| abstract class Set { | |
| def insert(v:Int): Set | |
| //def contains(v:Int): Boolean | |
| //def union(s:Set): Set | |
| //def remove(v:Int): Set | |
| //def filter(p: Int => Boolean):Set |
NewerOlder