Up until this point, all of the solving techniques have been fairly basic and straightforward. But there are a couple of more advanced strategies that are common enough that it is worth including them in the grading system. The first of these strategies is called X-Wing. X-Wings are built upon the premise that if in two separate rows a certain candidate appears only in the exact same two columns, then that candidate can be removed from all other cells in that column (Penny Publications 4). The strategy also works looking for the two same rows from the two same columns. Figure 9 provides an excellent example of an X-Wing situation. In the 5th and 8th columns, the only cells that have 5 as a potential candidate have been highlighted. Because these highlighted cells are in exactly two rows, X-Wing can be applied, and 5 can be removed as a candidate from three cells in those rows, as marked with red cross-outs.
While certainly a more advanced algorithm, X-Wing does not prove significantly more difficult to program. The straightforward approach to take is to loop through all possible combinations of boxes of initial x-position of 1 through 8 and initial y-position of 1 through 8 and terminal x-position between the initial x and 9 and y position between the initial y and 9. These will cover every possible way for an X-Wing to occur. With each box bounded by initial and terminal x and y positions, it is now a matter of determining whether the conditions for X-Wing apply. To do this, the computer simply goes through each candidate in the top left box, and checks to see if this candidate occurs only twice in either both rows or both columns. If it does, it then verifies that the candidate occurs in the corners of the box, and performs candidate removal if so. That takes care of solving all X-Wings. But there is one more peak to climb.