Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "farnarkle.h"
  3.  
  4. // return number of arkles
  5. int count_arkles(int sequence1[N_TILES], int sequence2[N_TILES]) {
  6.  
  7. int i, arkle, j, farn, tempArkle, farnTest, preFarn;
  8.  
  9. i = 0;
  10. arkle = 0;
  11. j = 0;
  12. farn = 0;
  13. tempArkle = 0;
  14. farnTest = 0;
  15.  
  16. //sequence 1 = hidden sequence = i
  17. //sequence 2 = guess = 2
  18.  
  19. while (i < N_TILES) {
  20. j = 0;
  21. while (j < N_TILES) {
  22.  
  23. if (sequence1[i] == sequence2[j] && j == i) {
  24. farn = 1;
  25. i = i + 1;
  26.  
  27. }
  28. else if (sequence1[i] == sequence2[j] && j != i && farn == 0 && tempArkle == 0 ) {
  29. arkle = arkle + 1;
  30. tempArkle = 1
  31. }
  32. if (preFarn > 0) {
  33. arkle = arkle - preFarn
  34. j = j + 1;
  35. farn = 0;
  36. }
  37. i = i + 1;
  38. tempArkle = 0;
  39. }
  40.  
  41.  
  42. return arkle;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement