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
from microbit import * | |
sleep_time = 200 | |
warning_time = 5000 | |
class Pinger: | |
def __init__(self): | |
self.direction = 1 | |
self.x = 2 |
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
from microbit import * | |
import speech | |
note_name_to_value = { | |
"c3" : "58", | |
"cs3" : "55", | |
"d3" : "52", | |
"ds3" : "49", | |
"e3" : "46", | |
"f3" : "44", |
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
# https://en.wikipedia.org/wiki/Langton's_ant | |
from microbit import * | |
import random | |
def create_new_ant(): | |
return [random.randint(0, 4), random.randint(0, 4)] # start at a random place on the board | |
def pick_direction(compass_points): | |
return random.choice(compass_points) |
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
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<UsingTask TaskName="SetTFSVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | |
<ParameterGroup> | |
<Name ParameterType="System.String" Required="true" /> | |
<Value ParameterType="System.String" Required="true" /> | |
</ParameterGroup> | |
<!-- https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md --> | |
<Task> |
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
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | |
<ParameterGroup> | |
<Name ParameterType="System.String" Required="true" /> | |
<Value ParameterType="System.String" Required="true" /> | |
</ParameterGroup> | |
<Task> | |
<Using Namespace="System" /> |
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 unittest | |
def count_special_chars(password): | |
return sum(letter in "<>!&*" for letter in password) | |
def contains_special_chars(password): | |
return count_special_chars(password) > 0 | |
def count_digits(password): | |
return sum(letter.isdigit() for letter in password) |
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
#include "MicroBit.h" | |
MicroBit micro_bit; | |
const uint8_t empty_heart_bitmap[] { | |
0, 1, 0, 1, 0, | |
1, 0, 1, 0, 1, | |
1, 0, 0, 0, 1, | |
0, 1, 0, 1, 0, | |
0, 0, 1, 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
#include "MicroBit.h" | |
MicroBit uBit; | |
int main() | |
{ | |
// Initialise the micro:bit runtime. | |
uBit.init(); | |
// Insert your code here! |
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
#include "MicroBit.h" | |
MicroBit micro_bit; | |
int main() | |
{ | |
micro_bit.init(); | |
const int delay_in_milliseconds = 1000; | |
const int full_brightness = 255; |
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
using NUnit.Framework; | |
[TestFixture] | |
public class RomanNumeralTest | |
{ | |
[Test] | |
public void Zero_Returns_Empty_String() | |
{ | |
Assert.AreEqual(string.Empty, RomanNumerals.ToRoman(0)); |
NewerOlder