ulong areaDespercidiada() { ulong A = (ulong)(W * H); A *= (ulong)(Table); for (int i = 0; i < Pieces.Count(); ++i) { A -= (ulong)(Pieces[i].Quant * Pieces[i].H * Pieces[i].W); } return(A); }
int FindBestFittingItem(int wmax, int hmax) { int index = -1; for (int i = 0; i < Pieces.Count(); ++i) { if (Pieces[i].W <= wmax && Pieces[i].Available > 0) { if (Pieces[i].H <= hmax) { Pieces[i].Available--; return(i); } } else { if (Pieces[i].H <= wmax && Pieces[i].Available > 0) { if (Pieces[i].W <= hmax) { Pieces[i].Available--; int temp = Pieces[i].H; Pieces[i].H = Pieces[i].W; Pieces[i].W = temp; if (Pieces[i].Normal == "G") { Pieces[i].Normal = "N"; } else { Pieces[i].Normal = "G"; } return(i); } } } } return(index); }