All pastes #576768 Raw Edit

Mine

public c v1 · immutable
·published 2007-06-19 16:43 UTC
rendered paste body
bool nomoremoves(card_t **piles, card_t **storage){  int i,j,numcards=0;  card_t *topcard, *bottomcard,*dest;  for(i=0;i<(PILES+STORAGES);i++)    numcards += i<PILES?countcards(piles[i]):countcards(storage[i-PILES]);  if(numcards<52)    return false;  for(i=0;i<PILES;i++){    topcard = piles[i];    bottomcard = topcard;    if(!IS_EMPTY(bottomcard))      while(!IS_EMPTY(NEXT_CARD(bottomcard)) &&             GET_VISIBLE(NEXT_CARD(bottomcard)) &&             successor(GET_VALUE(bottomcard)) == GET_VALUE(NEXT_CARD(bottomcard)) &&            !colormatch(GET_SUIT(bottomcard),GET_SUIT(NEXT_CARD(bottomcard))))        bottomcard = NEXT_CARD(bottomcard);    else      return false;    for(j=0;j<PILES+STORAGES;j++){      if(j<PILES){        dest = piles[j];        if(IS_EMPTY(dest))          return false;        if(successor(GET_VALUE(bottomcard)) == GET_VALUE(dest) && !colormatch(GET_SUIT(bottomcard),GET_SUIT(dest)))          return false;        continue;      }else{        dest = storage[j-PILES];        if(IS_EMPTY(dest)){          if(GET_VALUE(topcard) == ACE)            return false;          continue;        }        if(successor(GET_VALUE(dest)) == GET_VALUE(topcard) && GET_SUIT(dest) == GET_SUIT(topcard))          return false;        continue;      }    }  }  return true;}