Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "farnarkle.h"
- // return number of arkles
- int count_arkles(int sequence1[N_TILES], int sequence2[N_TILES]) {
- int i, arkle, j, farn, tempArkle, farnTest, preFarn;
- i = 0;
- arkle = 0;
- j = 0;
- farn = 0;
- tempArkle = 0;
- farnTest = 0;
- //sequence 1 = hidden sequence = i
- //sequence 2 = guess = 2
- while (i < N_TILES) {
- j = 0;
- while (j < N_TILES) {
- if (sequence1[i] == sequence2[j] && j == i) {
- farn = 1;
- i = i + 1;
- }
- else if (sequence1[i] == sequence2[j] && j != i && farn == 0 && tempArkle == 0 ) {
- arkle = arkle + 1;
- tempArkle = 1
- }
- if (preFarn > 0) {
- arkle = arkle - preFarn
- j = j + 1;
- farn = 0;
- }
- i = i + 1;
- tempArkle = 0;
- }
- return arkle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement