$flip is normally set within a set file. Since you are trying to override the value given to $pieces in your set file, you would need to set it explicitly in your code like you are doing with $pieces. But if you change your piece set to something using .png images and use aliases instead of trying to define your own set internally, you wouldn't need to change the value of $flip.
$flip is normally set within a set file. Since you are trying to override the value given to $pieces in your set file, you would need to set it explicitly in your code like you are doing with $pieces. But if you change your piece set to something using .png images and use aliases instead of trying to define your own set internally, you wouldn't need to change the value of $flip.