All pastes #938405 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-11 16:57 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>


#define CABBAGE 0x0100
#define SHEEP 	0x0104
#define WOLF 	0x1000

struct element {
	int boat;
	int stage[2][2];
	struct element *parent;
	struct element *next; /* NULL */
};

static element *parent, *son;

static const int start[1][1] = { {0}, {3} };
static const int end[1][1]   = { {3}, {0} };
static const int init_boat = 1;

int respect_rule(void) {
	struct element *no;
	if (no->stage[0][WOLF] < no->stage[0][SHEEP]
		&& no->stage[0][SHEEP] == no->stage[0][CABBAGE])
	if (no->stage[0][WOLF] == no->stage[0][SHEEP]
		&& !no->stage[0][CABBAGE])
	
	return -1;
}	

void do_lineup(void) {
	son = (struct element *)malloc(sizeof(struct element));
	son->parent = parent;
	parent = son->next->parent;
	son->barco = init_boat ^1;
	son->next = NULL;