[ create a new paste ] login | about

Link: http://codepad.org/klgZCMgU    [ raw code | fork ]

mavenman - PHP, pasted on Jan 18:

 * @param String $strStartingSquare – The knight’s current square in algebraic notation (e4) 
 * @return array – list of all valid squares the knight can move to in algebraic notation 
function getValidKnightSquares($strStartingSquare) {
  //Chess Board coords using algebraic notation
  //direction both vertical and horizontal
  //Range of Knight Movement
  //When file=1, rank=2 squares
  //When file=2, rank=1 squares

  //keys of Starting Square
  //valid move results
  //Walk valid movements
  foreach($moves as $a=>$b){
    //walk each sign for files
    foreach($signs as $c){
      //walk each sign for ranks
      foreach($signs as $d){
        //Get move based on starting pos for file/rank + sign*movement
        //check if move has valid length
  return $results;

Create a new paste based on this one