@OPERATION void sense() { OpFeedbackParam<PersonSenseData[]> people = new OpFeedbackParam<>(); OpFeedbackParam<PoTSenseData[]> points = new OpFeedbackParam<>(); try { execLinkedOp("env-link", "sense", ID, people, points); ObsProperty peoplep = getObsProperty("people"); ObsProperty pointsp = getObsProperty("points"); peoplep.updateValue(toArray(people.get())); pointsp.updateValue(toArray(points.get())); } catch (Exception e) { e.printStackTrace(); failed("Sense linked operation failed", "fail", ID, e); } }
@OPERATION void randomInt(OpFeedbackParam<Integer> res, int min, int max) { res.set(r.nextInt(max + 1 - min) + min); }
@OPERATION void random_int(int min, int max, OpFeedbackParam<Integer> res) { Random r = new Random(); res.set(r.nextInt((max - min + 1)) + min); }
@OPERATION void toss_coin(double prob, OpFeedbackParam<Boolean> res) { Random r = new Random(); res.set(r.nextDouble() < prob); }