Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zombies and Binary

Zombies and Binary

You may not use the PHP bitwise operators but every conditional you do is binary logic. These boolean comparisons underpin every-day programming and they can also be modelled in Minecraft. In fact, Minecraft is also a great place to model the internals of many common electronic components!

061e3bae4ce4234a2194d20a382e5d19?s=128

Christopher Pitt

October 22, 2014
Tweet

Transcript

  1. Binary

  2. $ php -a Interactive shell

  3. php > if (true) php > print "success"; success

  4. php > if (true and false) php > print "success";

  5. The sound of a thousand crickets...

  6. php > if (true and false) php > print "success";

    and wants both to be true
  7. php > if (true or false) php > print "success";

    success
  8. php > if (false or true) php > print "success";

    success
  9. With added variables!

  10. php > $one = true; php > $two = false;

    php > $three = true;
  11. php > if (($one and $two) and $three) php >

    print "success";
  12. ...chirp

  13. php > if (($one and $two) and $three) php >

    print "success"; this is false...
  14. php > if (($one and !$two) and $three) php >

    print "success"; success So we invert it!
  15. Success!

  16. Zombies

  17. * * with a custom theme

  18. Includes mining...

  19. ...and crafting!

  20. With added skellingtons!

  21. ...zombies

  22. None
  23. None
  24. None
  25. ...and creepers

  26. The bits that are important to us

  27. switch

  28. redstone (unpowered)

  29. redstone (powered)

  30. redstone lamp (unpowered)

  31. redstone lamp (powered)

  32. repeater

  33. signal attenuation

  34. problem?

  35. redstone torch (powered)

  36. redstone torch (unpowered)

  37. and gate

  38. input #1 input #2

  39. If both inputs are on the output is on

  40. or gate

  41. input #1 input #2

  42. If either input is on the output is on

  43. Repeaters are diodes!

  44. inverter (!)

  45. Input off Output on

  46. Input on Output off

  47. None
  48. all switches are off...

  49. $one = false; $two = false; $three = false;

  50. $one = !$one; $two = !$two; $three = !$three;

  51. $con1 = $one and $two;

  52. $con2 = $three and $con1;

  53. if ($con2) light();

  54. W AT!

  55. Minecraft does: allow us to model logic (by comparison) help

    us to think visually about control flow
  56. Minecraft does not: implement voltage, current, resistance etc. make variable

    storage easy
  57. 4051 (multiplexer)

  58. None
  59. accepts 1 input accepts 3 selection pins (high/low) passes the

    1 input through to one of 8 outputs, depending on on the selection pins
  60. Sound familiar?

  61. None
  62. Minecraft simulation of the internals of the multiplexer!

  63. Commandore 32

  64. None
  65. None
  66. None
  67. Commandore 32 32x32 pixel screen 16 colour (wool) 6kb vram

    32 bit bit.ly/commandore32
  68. Thanks! twitter.com/assertchris joind.in/12313 bit.ly/arduino-minecraft