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
| ====================================================== snapshot #1395 | |
| thread java.lang.Thread:{id:0,name:main,status:RUNNING,priority:5,isDaemon:false,lockCount:0,suspendCount:0} | |
| call stack: | |
| at robothunt.RobotGame.executeMove(RobotGame.java:148) | |
| at robothunt.RobotGame.play(RobotGame.java:79) | |
| at robothunt.RobotGame.main(RobotGame.java:35) | |
| Move: 8 | |
| ====================================================== error 1396 |
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
| // "server"-actor side | |
| import rglk._ | |
| import rglk.math._ | |
| import rglk.actors.{ Note, Actor } | |
| import rglk.world.typical.World2D.{ Position, Entity } | |
| object Main { | |
| def main(args: Array[String]): Unit = { | |
| rglk.Engine.start |
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
| object Main { | |
| def main = { | |
| val a = Automaton( | |
| Set(1, 2, 3), // set of states | |
| (state, letter) -> (state, letter) match { // transition function | |
| case (1, 'a') => 2 | |
| case (2, 'b') => 3 | |
| case (3, 'b') => 3 | |
| case _ => 0 | |
| }, |
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
| case class Automaton(states : Set[Int], transition : (Int, Char) -> Int, success : Set[Int], current : Int) { | |
| def is_success = success contains current | |
| def is_sink = states contains current | |
| def move(c : Char) = Automaton(states, alphabet, transition, success, transition(current, c)) | |
| def advance(s : List[Char]) = s match { | |
| case h :: tail => this.move(h).advance(tail) | |
| case _ => this | |
| } |
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 Automaton[State, Alphabet]( | |
| transition : (State, Alphabet) => Option[State], | |
| current : State, | |
| finals : Set[State]) { | |
| def advance(letter : Alphabet): Automaton[State, Alphabet] = transition(current, letter) match { | |
| case None => this | |
| case Some(x) => new Automaton[State, Alphabet](states, transition, x, finals) | |
| } |
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
| 0 0 0 0 0 0 0 0 0 0 | |
| 0 0 0 0 0 0 0 0 0 0 | |
| 0 0 0 0 0 0 0 0 0 0 | |
| 0 0 0 0 0 0 0 0 0 0 | |
| 0 0 0 0 0 0 0 0 0 0 | |
| 1 0 0 0 0 0 0 0 0 0 | |
| 1 0 0 0 0 0 0 0 0 0 | |
| 1 0 0 0 0 0 0 0 0 0 | |
| 1 0 0 0 0 0 0 0 0 0 |
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
| /* | |
| 10 x 10 matrix (so n = m = 10). any n != m matrix can be made into a (n x m) matrix without loss. | |
| we initialize the whole matrix to 0 and 1, in the following way: | |
| 1 1 1 1 1 1 1 1 1 1 | |
| 1 0 0 0 0 0 0 0 0 1 | |
| 1 0 0 0 0 0 0 0 0 1 | |
| 1 0 0 0 0 0 0 0 0 1 | |
| 1 0 0 0 0 0 0 0 0 1 |
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
| classes(cn).fields.foreach { f ⇒ | |
| f match { | |
| case d@Decl(v, ct) ⇒ { | |
| ct match { | |
| case ClassT(k) ⇒ { | |
| val ofield = Graph.allocNode(k, target.id) | |
| ofield.ptsto += Null | |
| target.ptsto.head match { | |
| case obj@ObjNode(_,_,_,_,_) ⇒ { | |
| obj.fields += ((v, ofield)) |
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
| pattern FactoryPattern<implicit Factory, Product> { | |
| T <T extends Product> Factory::create() { return new T(factory: self) } | |
| Factory Product::factory; | |
| Factory Product::getFactory() { return self.factory } | |
| } | |
| interface Car { | |
| public String getType(); | |
| } |
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
| Object has: #Person | |
| with_members: (#a #b #sum) | |
| so_that: { | |
| sum does: { a + b } | |
| } | |