Skip to content

Instantly share code, notes, and snippets.

View gavrilovmiroslav's full-sized avatar
🎯
Focusing

Miroslav gavrilovmiroslav

🎯
Focusing
View GitHub Profile
====================================================== 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
// "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
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
},
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
}
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)
}
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
/*
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
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))
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();
}
Object has: #Person
with_members: (#a #b #sum)
so_that: {
sum does: { a + b }
}