Exactly three adjacent 3 in lists: Difference between revisions

Content added Content deleted
m (→‎{{header|Ring}}: needs improvement)
Line 151:
 
=={{header|Ring}}==
 
{{improve|Ring|Works but is severely limited. What if you passed in the list [4,1,2,1,7,3,3,3]? (index bounds fault) or [9,2,4,1,2,1,7,3,3,3]? (incorrectly fails)}}
<lang ring>
see "working..." + nl
Line 165:
good = 0
cnt = 0
for plen = 1 to 9len(list[n])
for p = 1 to len
if list[n][p] = 3
good++
Line 171 ⟶ 172:
next
if good = 3
for m = 1 to 7len-2
if list[n][m] = 3 and list[n][m+1] = 3 and list[n][m+2] = 3
cnt++