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 = 0;
- int j = 0;
- int k = 0;
- int stop = 0;
- int count = 0;
- int modifyable_list[N_TILES];
- while(k < N_TILES){ //duplicate sequence 2 for modification purposes
- modifyable_list[k] = sequence2[k];
- k++;
- }
- while(i < N_TILES){
- stop = 0;
- j = 0;
- while(j < N_TILES && stop != 1){
- if((sequence1[i] == modifyable_list[j]) && (sequence1[j] != modifyable_list[j] && sequence1[i] != modifyable_list[i])){ //second comparison would make it a farnarkle
- stop = 1;
- modifyable_list[j] = -1; //set the variable to something out of range
- count++;
- }
- j++;
- }
- i++;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement