fixed compass bug

This commit is contained in:
Peli de Halleux
2017-03-29 06:47:52 -07:00
parent b3ad4e5b4d
commit a2a28391d0
4 changed files with 14 additions and 43 deletions

View File

@ -25,24 +25,24 @@ basic.forever(() => {
})
```
If `degrees` is less than `45`, then the compass heading is mostly pointing toward North. Display `N` on the @boardname@.
If `degrees` is less than `45` or greater than `315`, then the compass heading is mostly pointing toward North. Display `N` on the @boardname@.
```blocks
basic.forever(() => {
let degrees = input.compassHeading();
if (degrees < 45) {
if (degrees < 45 || degrees > 315) {
basic.showString("N");
}
});
```
If `degrees` is less than 135, the @boardname@ is mostly pointing East. Display `E` on the @boardname@.
```blocks
basic.forever(() => {
let degrees = input.compassHeading();
if (degrees < 45) {
if (degrees < 45 || degrees > 315) {
basic.showString("N");
}
else if (degrees < 135) {
@ -57,7 +57,7 @@ If `degrees` is less than 225, the @boardname@ is mostly pointing South. Display
```blocks
basic.forever(() => {
let degrees = input.compassHeading();
if (degrees < 45) {
if (degrees < 45 || degrees > 315) {
basic.showString("N");
}
else if (degrees < 135) {
@ -70,12 +70,12 @@ basic.forever(() => {
```
If none of these conditions returned true, then the @boardname@ must be pointing West. Display `W` on the @boardname@.
If none of these conditions are true, then the @boardname@ must be pointing West. Display `W` on the @boardname@.
```blocks
basic.forever(() => {
let degrees = input.compassHeading();
if (degrees < 45) {
if (degrees < 45 || degrees > 315) {
basic.showString("N");
}
else if (degrees < 135) {