/lightswitches

simple bitwise operation to flip lightswitches

Primary LanguageC

light switches

Simple example of flipping switches using bitwise operators.

Compiling

make

Output

56 Light Switches
all off
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 
 .  .  .  .  .  .  . 

all on
001002003004005006007
008009010011012013014
015016017018019020021
022023024025026027028
029030031032033034035
036037038039040041042
043044045046047048049
050051052053054055056

squares
001 .  . 004 .  .  . 
 . 009 .  .  .  .  . 
 . 016 .  .  .  .  . 
 .  .  . 025 .  .  . 
 .  .  .  .  .  .  . 
036 .  .  .  .  .  . 
 .  .  .  .  .  . 049
 .  .  .  .  .  .  .