3 kyu

One line task: Is the King in check ?

57 of 140Torkel
Description
Loading description...
Restricted
Puzzles
  • Please sign in or sign up to leave a comment.
  • tsegeron Avatar

    Finally, holy, that was tough, spent 3 days, but the satisfaction is huge. At first I didn't notice that I had to fit into 280 characters – wrote 1700 :D

  • goldenratio161 Avatar

    I found a solution on the easier version of this kata, copy pasted it over, and it worked first try. I did not mean for it to work, so I obviously don't want the honor/points, so I am currently trying to do this kata my way. Having said that, is there a way to block solutions like this on the easier kata, and possibly make it a feature to hide solutions after submitting?

  • Bdotjs Avatar

    This comment has been hidden.

  • Sarnavskiy-Alexey Avatar

    This was very hard, but finally I attempted my solution on Python in 271 symbols!

  • nathell Avatar

    Got it down to 299 characters in Clojure using some very dirty tricks, and I don't think I can get any lower without a radically new approach (update: I did it, although the approach was sub-optimal as shown by other solutions).

    But it's been tremendously fun! :)

  • user2150589 Avatar

    The semicolon restriction for js is crazy

  • lachesism Avatar

    Hi,
    You need more edge test cases to avoid solutions, such as my python's solution, which can't work when there is a chess blocking another's line of sight, passing the test.

  • Kacarott Avatar

    Should be updated to Python 3.8

  • Twilight_Sun Avatar

    This comment has been hidden.

  • achambily Avatar

    Hi everybody. I don't understand what "is_check=lambda board: False" in the first line of the solution means. Am I not supposed to write a function def is_check(board) where board is a list and return a boolean ?

  • W_2004 Avatar

    Any chess players here?

    Here is a question:

    Consider such a board:

    [' ',' ',' ',' ',' ',' ',' ',♛ ],
    [♝,' ',' ',' ',' ',' ',' ',' ' ],
    [' ',' ',' ',' ',' ',' ',' ',' '],
    [' ',' ',' ',' ',' ',' ',' ',' '],
    [' ',' ',' ',' ',' ',' ',' ',' '],
    [' ',' ',' ',' ',' ',' ',' ',' ' ],
    [' ',' ',' ',' ',' ',' ',' ',' '],
    [' ',' ',♔,' ',' ',' ',♟ , ' ']
    

    When the white pawn reaches the the very last line of the oposite side, it has a right to transform into any chess piece. By default it's a queen. So in the above case the king would automatically be in check.

    So, does such a case have to be handled as well?

  • cipix2000 Avatar

    This kata was brutal. I started from 390 chars and had to cut 110 from my solution. I almost gave up. I think is one of the hardest 3 kyu kata I did

  • Blind4Basics Avatar

    This comment has been hidden.

  • G_kuldeep Avatar

    tried and failed at 320.. any hints??

  • user8751232 Avatar

    Since no one had anything to say, approved.

  • lechevalier Avatar

    You should use a specific length bound for each language. For example in Python, I have obtained a 220-character-long solution, which is far below initial requirements of 280 characters.

  • lechevalier Avatar

    Snake case is required in Python. Moreover your python solution contains a semicolon.

  • lechevalier Avatar

    This comment has been hidden.

  • user7147914 Avatar

    No semicolons makes it impossible to use for loops, is that on purpose?

  • user7147914 Avatar

    Remember that pawns can only move and take forward.

    For people who don't know chess, it might be nice to specify that pawns take forward diagonally.

  • Unnamed Avatar

    I think snake_case is usually used in Ruby for methods.

  • FArekkusu Avatar

    Don't put HTML formatting in a code block.

  • emgordon154 Avatar

    That was absolutely brutal. Excellent golf course.