std::string pretty(Move m, Piece movedPieceType) { if (is_drop(m)) return (pretty(move_to(m)) + pretty2(movedPieceType) + (pretty_jp ? "打" : "*")); else return pretty(move_to(m)) + pretty2(movedPieceType) + (is_promote(m) ? (pretty_jp ? "成" : "+") : "") + "["+ pretty(move_from(m))+"]"; }
std::string pretty(Move m) { if (is_drop(m)) return (pretty(move_to(m)) + pretty2(Piece(move_from(m))) + (pretty_jp ? "打" : "*")); else return pretty(move_from(m)) + pretty(move_to(m)) + (is_promote(m) ? (pretty_jp ? "成" : "+") : ""); }
int sign(int a[10],int j, int degree){ /* function to decide whether term needs a + or - before it */ for (int j=0;j<=degree;j++){ /*for loop to count up the polynomial with the power decreasing */ int result =0; int k=j; while(k>=0){ /*While loop to go through loop and sum the previous terms so decide if the term needs a + or minus before it */ result= a[k-1]+result; k--; } if(result!=0){ /*If the sum is not 0, original printing takes place, assuming coefficient is not 0, by calling the pretty function */ if(a[j]!=0){ pretty(a,j,degree);} } else { /* If sum is 0, then printing will take place with no + or -, assuming coefficient is not 0, by calling pretty2 function */ if(a[j]!=0){ pretty2(a,j,degree); } } } return 0; /* Returns 0 to the main function*/ }