Advertisement
Guest User

Untitled

a guest
Dec 18th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. function checkRows : boolean;
  2. begin
  3. for i:=1 to 81 do
  4. begin
  5. if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the row
  6. begin
  7. row := (((i-1)/9)+1); //determines the row
  8. for v:=1 to 81 do
  9. begin
  10. if (row = (((v-1)/9)+1)) then //checks if the row of boxes 1-81 matches the row of the string above ^
  11. begin
  12. if not (v = i) then //if the box is not the same box as the correct string ^
  13. begin
  14. if not ((pos(ansArray[i], ansArray[v])) = 0) then //if the string can be found in any of the strings on the same row
  15. begin
  16. //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same row');
  17. delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
  18. result := true;
  19. end;
  20. end;
  21. end;
  22. end;
  23. end;
  24. end;
  25. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement