Skip to content

Commit

Permalink
Minor change to ultrasonic sense()
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelChanZhiYang committed Apr 15, 2024
1 parent 2836ac0 commit 53869e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class UltrasonicSensor implements Sensor<number> {
}

sense(): number {
return this.distanceSensed;
return this.distanceSensed * 100;
}

fixedUpdate(): void {
Expand Down
6 changes: 2 additions & 4 deletions src/bundles/robot_simulation/controllers/program/evaluate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@

import { type IOptions } from 'js-slang/dist';

import { Control, Stash, generateCSEMachineStateStream } from 'js-slang/dist/cse-machine/interpreter';
import { parse } from 'js-slang/dist/parser/parser';
import { Variant, type Context, type RecursivePartial } from 'js-slang/dist/types';
import { Variant, type Context } from 'js-slang/dist/types';
import * as _ from 'lodash';

export const DEFAULT_SOURCE_OPTIONS = {
Expand All @@ -27,7 +25,7 @@ export const DEFAULT_SOURCE_OPTIONS = {
export function* runECEvaluator(
code: string,
context: Context,
options: RecursivePartial<IOptions>,
options: any,
): Generator<{ steps: number }, void, undefined> {
const theOptions = _.merge({ ...DEFAULT_SOURCE_OPTIONS }, options);
const program = parse(code, context);
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/robot_simulation/ev3_functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export function ev3_ultrasonicSensor() {
export function ev3_ultrasonicSensorDistance(
ultraSonicSensor: UltrasonicSensor
): number {
return ultraSonicSensor.sense() * 100;
return ultraSonicSensor.sense();
}

/**
Expand Down

0 comments on commit 53869e0

Please sign in to comment.