Beispiel #1
0
        public static String getCoordsStr(Move move, bool compactOutput = false)
        {
            String output = getCoordsStr(move.getFrom()[0], move.getFrom()[1]);

            if (!compactOutput)
            {
                ArrayList fieldsOver    = move.getOverFields();
                int       fieldsOverLen = fieldsOver.Count;
                for (int i = 0; i < fieldsOverLen; i++)
                {
                    output += " " + getCoordsStr((int)(fieldsOver[i] as Array).GetValue(0), (int)(fieldsOver[i] as Array).GetValue(1));
                }
            }
            return(output + " " + getCoordsStr(move.getTo()[0], move.getTo()[1]));
        }
Beispiel #2
0
        public bool isEqual(Move move)
        {
            if (from[0] != move.getFrom()[0] || from[1] != move.getFrom()[1])
            {
                return(false);
            }
            if (to[0] != move.getTo()[0] || to[1] != move.getTo()[1])
            {
                return(false);
            }

            ArrayList moveFields = move.getOverFields();
            int       fieldsCnt  = over.Count;

            if (fieldsCnt != moveFields.Count)
            {
                return(false);
            }
            for (int i = 0; i < fieldsCnt; i++)
            {
                if (((int[])over[i])[0] != ((int[])moveFields[i])[0] || ((int[])over[i])[1] != ((int[])moveFields[i])[1])
                {
                    return(false);
                }
            }

            moveFields = move.getRemoveFields();
            fieldsCnt  = remove.Count;
            if (fieldsCnt != moveFields.Count)
            {
                return(false);
            }
            for (int i = 0; i < fieldsCnt; i++)
            {
                if (((int[])remove[i])[0] != ((int[])moveFields[i])[0] || ((int[])remove[i])[1] != ((int[])moveFields[i])[1])
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #3
0
        private void highlightMove(Move move)
        {
            ArrayList overFields      = move.getOverFields();
            ArrayList removeFields    = move.getRemoveFields();
            String    pieceEndStr     = null;
            int       overFieldsLen   = overFields.Count;
            int       removeFieldsLen = removeFields.Count;
            int       i;

            drawPictureBoxControl(pieces[move.getFrom()[0], move.getFrom()[1]], Properties.Resources.piece_control_select); // start piece
            for (i = 0; i < overFieldsLen; i++)                                                                             // pieces jumped over in multi-jump
            {
                drawPictureBoxControl(pieces[(int)(overFields[i] as Array).GetValue(0), (int)(overFields[i] as Array).GetValue(1)], Properties.Resources.piece_control_select, (i + 1).ToString());
            }
            for (i = 0; i < removeFieldsLen; i++)          // pieces removed
            {
                drawPictureBoxControl(pieces[(int)(removeFields[i] as Array).GetValue(0), (int)(removeFields[i] as Array).GetValue(1)], Properties.Resources.piece_control_error);
            }
            if (overFieldsLen > 0)      // add number for end piece if multi-jump
            {
                pieceEndStr = i.ToString();
            }
            drawPictureBoxControl(pieces[move.getTo()[0], move.getTo()[1]], Properties.Resources.piece_control_select, pieceEndStr);     // end piece
        }