Skip to content

Instantly share code, notes, and snippets.

View jakorten's full-sized avatar

Johan Korten jakorten

View GitHub Profile
@jakorten
jakorten / clean_code.md
Created June 29, 2023 04:37 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jakorten
jakorten / basisLijnVolgen.py
Created November 29, 2022 14:20
Code basis Lijnvolger
#
# Lijn volg basis voor MicroBit Robot
# 29 nov 2022 - v0.1
#
def sensorRechtsOpLijn():
return DFRobotMaqueenPlus.read_patrol(Patrol.R1) == 1
def vindLijn():
global robotState
robotState += STATE_VERDWAALD
@jakorten
jakorten / basicSocialRobot.py
Last active October 18, 2022 17:48
Basis code voor een robotje wat samen met andere robotjes kan dansen.
def robotDance():
pass
def on_received_number(robotTaskState):
global andereRobotAfstand
global robotTaskState
global STATE_DANCE
andereRobotAfstand += radio.received_packet(RadioPacketProperty.SIGNAL_STRENGTH)
if andereRobotAfstand <= afstandsLimiet:
if robotTaskState == STATE_DANCE:
@jakorten
jakorten / lijnvolger.py
Last active October 3, 2022 18:16
Python code - Basis Lijnvolger
"""
Python code voor Microbit / DFRobot Maqueen Plus
Johan Korten voor Q-Highschool en Hogeschool van Arnhem en Nijmegen
v1.0 okt 2022
"""
sensorL1 = False
sensorL2 = False
lijnInMidden = False