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
1 2 3 | |
0 0 0 | |
0 0 0 | |
Rotate left | |
2 3 0 | |
1 0 0 | |
0 0 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
private void createQueue() { | |
queue = new ArrayDeque<When<Predicate<RobotState>,Fn>>(); | |
queue.push(when(isOnWhiteLine,driveLongBackward)); //if already on white line move backward | |
queue.push(when( and(isIdle, not(isOnWhiteLine)), driveForward)); //start driving forward | |
queue.push(when( and(isMoving, isOnWhiteLine), stopRobot)); //stop when white line is detected | |
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 procedure; | |
import model.Color; | |
import model.Direction; | |
import model.DrawRequest; | |
import model.DrawType; | |
import model.Position; | |
import model.RobotActivity; | |
import model.RobotState; | |
import model.Rotation; |
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
* Drives the robot in the requested direction. As always the direction is in the relative axis of the robot, | |
* instead of the absolute one. | |
* @param reqDir | |
*/ | |
private void driveSectorLengthInDirection(Orientation reqDir) { | |
if(reqDir == currentOrientation.turnClockWise()){ | |
getRobot().rotate(90, Rotation.CLOCKWISE); | |
}else if(reqDir == currentOrientation.turnAntiClockWise()){ | |
getRobot().rotate(90, Rotation.COUNTERCLOCKWISE); | |
}else if(reqDir == currentOrientation.opposite() ) { |
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
Name: V(i), i=1..6, domain: 0..9 | |
Name: E(i), i=1..9, domain: 1..9 | |
Constraint: V(i) \= V(j), range: i < j | |
Constraint: E(i) \= E(j), range: i < j | |
Constraint: E(i) = abs(V(b)-V(a)) /\ E(j) = abs(V(c)-V(d)) /\ E(k) = abs(V(e)-V(f)), range: i >= 0, i =< 3, a=i, b = (a mod 3) + 1, b <= 3 , j=i+3, c=a+3,d=b+3, k=i+6, e=a, f=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
Idea | |
------ | |
I'm redesigning last years project in java (course: OOP) | |
Long story short: | |
I have a "board" ,"robot" "item", "wall" | |
a board contains pieces at certain positions |
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.IOException; | |
import java.io.OutputStream; | |
import lejos.pc.comm.NXTComm; | |
import lejos.pc.comm.NXTCommException; | |
import lejos.pc.comm.NXTCommFactory; | |
import lejos.pc.comm.NXTInfo; | |
/* | |
* RUNS ON PC |
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 meta.nxt; | |
public interface SampleInterface { | |
public void singleint (int a); | |
public void twiceint (int a, int b); |
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 p2; | |
/** | |
* Person with string address | |
*/ | |
public final class Person{ | |
public final String name; | |
public final String address; //addres defined in the same manner as person | |
public final JodaDate birthdate; //because java date suck |
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
(ns aimd.core | |
(:require [incanter.core :as ic] | |
[incanter.stats :as stats] | |
[incanter.charts :as charts])) | |
(defn increase-rate | |
"Additive incrementation of the rate of sender s with a factor n" | |
[n s] | |
(update-in s [:rate] + n)) |
OlderNewer