aboutsummaryrefslogtreecommitdiff
path: root/challenge-209/roger-bell-west/lua/ch-1.lua
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-209/roger-bell-west/lua/ch-1.lua')
-rwxr-xr-xchallenge-209/roger-bell-west/lua/ch-1.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-209/roger-bell-west/lua/ch-1.lua b/challenge-209/roger-bell-west/lua/ch-1.lua
new file mode 100755
index 0000000000..12e8a3247f
--- /dev/null
+++ b/challenge-209/roger-bell-west/lua/ch-1.lua
@@ -0,0 +1,28 @@
+#! /usr/bin/lua
+
+function specialbitcharacters(a)
+ local s = 0
+ for k, v in ipairs(a) do
+ if s == 1 then
+ s = 2
+ else
+ s = v
+ end
+ end
+ return s == 0
+end
+
+if specialbitcharacters({1, 0, 0}) then
+ io.write("Pass")
+else
+ io.write("FAIL")
+end
+io.write(" ")
+
+if not specialbitcharacters({1, 1, 1, 0}) then
+ io.write("Pass")
+else
+ io.write("FAIL")
+end
+print("")
+