Update more docs
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
## Unplugged: Two heads are better than one
 | 
			
		||||
<!-- ## Unplugged: Two heads are better than one
 | 
			
		||||
 | 
			
		||||
Materials: A penny for each student, paper and pencils
 | 
			
		||||
 
 | 
			
		||||
@@ -208,4 +208,4 @@ Our basic pseudocode for our 'double coin flipper' could look like this:
 | 
			
		||||
3. Compare the current values of Coin A and Coin B.
 | 
			
		||||
4. If the current true/false values of Coin A and Coin B are the same, add a point to Player A’s score.
 | 
			
		||||
5. Otherwise, the current true/false values of Coin A and Coin B must be different, so add a point to Player B’s score.
 | 
			
		||||
6. When players are done with their double coin flipping, show the final scores for each player.
 | 
			
		||||
6. When players are done with their double coin flipping, show the final scores for each player. -->
 | 
			
		||||
 
 | 
			
		||||
@@ -96,55 +96,42 @@ Thanks for playing with Karel the LED!
 | 
			
		||||
Copy this code into the JavaScript editor and then download it to the board.
 | 
			
		||||
 | 
			
		||||
```typescript
 | 
			
		||||
const board = new Board();
 | 
			
		||||
/**
 | 
			
		||||
 * Karel the LED
 | 
			
		||||
 */
 | 
			
		||||
basic.forever(() => {
 | 
			
		||||
    if (board.isKarelActive) {
 | 
			
		||||
        led.toggle(board.karelX, board.karelY)
 | 
			
		||||
        basic.pause(500)
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.A, () => {
 | 
			
		||||
    board.pressedA();
 | 
			
		||||
    updateLeds();
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.B, () => {
 | 
			
		||||
input.onButtonPressed(Button.B, function () {
 | 
			
		||||
    board.pressedB();
 | 
			
		||||
    updateLeds();
 | 
			
		||||
updateLeds()
 | 
			
		||||
})
 | 
			
		||||
input.onGesture(Gesture.Shake, () => {
 | 
			
		||||
input.onGesture(Gesture.Shake, function () {
 | 
			
		||||
    board.shake();
 | 
			
		||||
    updateLeds();
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.AB, () => {
 | 
			
		||||
    board.pressedAB();
 | 
			
		||||
    updateLeds();
 | 
			
		||||
updateLeds()
 | 
			
		||||
})
 | 
			
		||||
function updateLeds() {
 | 
			
		||||
    for (let j = 0; j < 5; j++) {
 | 
			
		||||
        for (let k = 0; k < 5; k++) {
 | 
			
		||||
    for (let j = 0; j <= 5 - 1; j++) {
 | 
			
		||||
        for (let k = 0; k <= 5 - 1; k++) {
 | 
			
		||||
            if (board.ledState[j][k]) {
 | 
			
		||||
                led.plot(k, j);
 | 
			
		||||
                led.plot(k, j)
 | 
			
		||||
            } else {
 | 
			
		||||
                led.unplot(k, j);
 | 
			
		||||
                led.unplot(k, j)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
enum Direction {
 | 
			
		||||
    UP = 0,
 | 
			
		||||
    LEFT,
 | 
			
		||||
    DOWN,
 | 
			
		||||
    RIGHT
 | 
			
		||||
}
 | 
			
		||||
input.onButtonPressed(Button.A, function () {
 | 
			
		||||
    board.pressedA();
 | 
			
		||||
updateLeds()
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.AB, function () {
 | 
			
		||||
    board.pressedAB();
 | 
			
		||||
updateLeds()
 | 
			
		||||
})
 | 
			
		||||
class Board {
 | 
			
		||||
    public isKarelActive: boolean;
 | 
			
		||||
    public karelX: number;
 | 
			
		||||
    public karelY: number;
 | 
			
		||||
 | 
			
		||||
    public ledState: Array < Array < boolean >>;
 | 
			
		||||
    public ledState: Array<Array<boolean>>;
 | 
			
		||||
    private karelDirection: Direction;
 | 
			
		||||
 | 
			
		||||
    constructor() {
 | 
			
		||||
@@ -152,7 +139,7 @@ class Board {
 | 
			
		||||
        this.karelX = 2;
 | 
			
		||||
        this.karelY = 2;
 | 
			
		||||
        this.karelDirection = Direction.UP;
 | 
			
		||||
        this.ledState =[];
 | 
			
		||||
        this.ledState = [];
 | 
			
		||||
        for (let i = 0; i < 5; i++) {
 | 
			
		||||
            this.ledState.push([false, false, false, false, false]);
 | 
			
		||||
        }
 | 
			
		||||
@@ -212,6 +199,19 @@ class Board {
 | 
			
		||||
        this.isKarelActive = !this.isKarelActive;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
const board = new Board();
 | 
			
		||||
enum Direction {
 | 
			
		||||
    UP = 0,
 | 
			
		||||
    LEFT,
 | 
			
		||||
    DOWN,
 | 
			
		||||
    RIGHT
 | 
			
		||||
}
 | 
			
		||||
basic.forever(function () {
 | 
			
		||||
    if (board.isKarelActive) {
 | 
			
		||||
        led.toggle(board.karelX, board.karelY)
 | 
			
		||||
        basic.pause(500)
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## About the authors
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# micro:coin
 | 
			
		||||
<!-- # micro:coin
 | 
			
		||||
 | 
			
		||||
## ~ avatar
 | 
			
		||||
 | 
			
		||||
@@ -84,4 +84,4 @@ The [radio-blockchain](https://makecode.microbit.org/pkg/microsoft/pxt-radio-blo
 | 
			
		||||
```package
 | 
			
		||||
radio
 | 
			
		||||
radio-blockchain=github:Microsoft/pxt-radio-blockchain#master
 | 
			
		||||
```
 | 
			
		||||
``` -->
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,9 @@ namespace pxsim.visuals {
 | 
			
		||||
            -webkit-filter: grayscale(1);
 | 
			
		||||
            filter: grayscale(1);
 | 
			
		||||
        }
 | 
			
		||||
        .sim-button-group {
 | 
			
		||||
            cursor: pointer;
 | 
			
		||||
        }
 | 
			
		||||
        .sim-button {
 | 
			
		||||
            pointer-events: none;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user