Very "effen" cool! Kind of makes me think of my roomba vacuum lol. I was wondering about the effectiveness of a "random" move as well. Also, for example, if you have a wall at center and east, how can you have anything to the north? Are there more rules that cant happen?
I added this for a graphical representation of the Decipher Rules Results (@rules table), made it easier to follow the rules...(oh yeah, you have to view in results to text 😉 )
declare @crlf char(2)
set @crlf = char(13) + char(10)
select ' ' +
case n
when 0 then ' O '
when 1 then ' X '
when 2 then '!!!'
end
+ ' ' + @crlf +
case w
when 0 then ' O '
when 1 then ' X '
when 2 then '!!!'
end
+
case c
when 0 then ' O '
when 1 then ' X '
when 2 then '!!!'
end
+
case e
when 0 then ' O '
when 1 then ' X '
when 2 then '!!!'
end
+ ' = ' +
case a
when 0 then 'Go North'
when 1 then 'Go South'
when 2 then 'Go East'
when 3 then 'Go West'
when 4 then 'Pick up'
when 5 then 'Move Random'
end
+ @crlf + ' ' +
case s
when 0 then ' O '
when 1 then ' X '
when 2 then ' _ '
end
+ ' ' + @crlf + '-----------------------' + @crlf
from @rules
order by n, w, c, e, s, a