Tuesday, October 13, 2015

Programming blog/YouTube series with simple games

Programming blog/YouTube series with simple games (see Max Wihlborg for HTML5 games). Aim: There are lots of challenges that help becoming a better programmer and it is more fun coding games, i.e. it is more probable that I will keep my motivation and have a working product in the end.
  • Snake
    • Difference between real world snake and game snake: Real world snake's body segements persist while the snake moves. Game snake segments are modeled as a list and whenever the snake moves, a new segment is added to the end of list and the first segment is deleted from list, which makes it easier to code. If we want to code the real world snake, we have to keep the segments and update positions of each snake segment when a motion occurs (which is harder to code).
  • Flappy Bird
  • Pong
  • Space Invaders
  • Tetris
  • Asteroids
  • Lunar Lander
    • C# code
    • Assembly code
    • Scrolling map
    • Zoom when close to terrain
    • Change gravity (Moon, Mars, Earth, Saturn)
    • Show minimap at the top (like Defender)
    • Autpilot
  • PacMan

Friday, October 9, 2015

Sunday, October 4, 2015

Garage door opener

Attach the garage door remote control to car dashboard and make it open the door automatically when the car is close to and facing towards the garage door.

Update 26.01.2017: Hack garage door opener. Watch Sammy Kamkar.

Thursday, October 1, 2015

Network simulation with threads

  • One live master, two standby masters listening if there is a live master.
  • Live master broadcasts every second that he is alive (hearbeat)
  • If standby masters do not get heartbeat for 10 seconds, one of them randomly becomes new live master
  • Optional: Gossip protocol: One standby might get the heartbear while the other can't. In that case the one that gets the hearbeat refuses the request of the other to become live master.
  • Master distributes jobs to worker nodes.
  • Worker nodes tell master every second that they are alive
  • Worker nodes return with an answer when their job finishes. Note that job might take more than 1 second. We need one thread for heartbeat and one thread for job processing.
  • GUI: Show live master, standby masters, working nodes, idle nodes, offline nodes.