unsigned char playRandomGame( void ) { usint i; struct moveset mv; mv.moves = calloc(AREA, sizeof(usint)); mv.movecount = 0; for( i = 0; ; i++ ) { int move; unsigned char color = i % 2; setupPossibleMoves( &mv, color ); if( mv.movecount == 0 ) { if( i == 0 ) { color++; } else { color--; } return color; } move = make_move( mv.moves, mv.movecount ); create_stone( move, color ); } }
void JoinHandlerFunc(EVmaster master, char * identifier, void * cur_unused1, void * cur_unused2) { /*This code does not handle code in the stones yet */ //TODO: Make it so we can have stones actually do stuff static int num_of_nodes = 0; //We need this for the python lists //static std::vector<std::string> node_names; ++num_of_nodes; if(num_of_nodes < test_dfg.node_count) { printf("Received node %s\n", identifier); EVmaster_assign_canonical_name(master, identifier, identifier); return; } printf("Received node %s\n", identifier); EVmaster_assign_canonical_name(master, identifier, identifier); EVdfg_stone *stones = (EVdfg_stone*)malloc(sizeof(EVdfg_stone) * stone_holder.size()); test_dfg.dfg = EVdfg_create(test_dfg.dfg_master); for(unsigned i = 0; i < stone_holder.size(); ++i) { /*Getting the stones correctly set up when they are not sources and sinks will go here*/ } for(unsigned i = 0; i < stone_holder.size(); ++i) { stones[i] = create_stone(stone_holder[i]); if(!stones[i]) { fprintf(stderr, "Error: stone not created in handler function\n"); exit(1); } char * p = strdup(stone_holder[i].node_name.c_str()); EVdfg_assign_node(stones[i], p); free(p); } for(unsigned i = 0; i < stone_holder.size(); ++i) { for(unsigned j = 0; j < stone_holder[i].incoming_stones.size(); ++j) { std::string temp_string1 = stone_holder[i].incoming_stones[j]; std::string temp_string2 = temp_string1 + "_py_src"; for(unsigned k = 0; k < stone_holder.size(); ++k) { if((!temp_string1.compare(stone_holder[k].stone_name)) || (!temp_string2.compare(stone_holder[k].stone_name))) { EVdfg_link_dest(stones[k], stones[i]); break; } } } } // Realize the dfg hopefully EVdfg_realize(test_dfg.dfg); }