Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How confident are you that you could have done this?

Author: Tony Werten

Date: 04:21:19 02/10/06

Go up one level in this thread


On February 09, 2006 at 23:53:33, Derek Mauro wrote:

>So, today I found out that there was going to be an ACM programming contest at
>my school.  Someone who knew I liked to program told me I should participate for
>fun.  It was an algorithm contest.  We were given 4 problems to solve in two
>hours.
>
>I read the first question.  Basically, you were given a 4x4 magic square (see
>http://en.wikipedia.org/wiki/Magic_square if you don't know what that is) with 2
>spots missing.  Fill in the 2 missing spots and print the magic square.  This is
>a pretty easy problem, and I figured it shouldn't take more than 10 minutes, if
>even that long.
>
>I looked at the second question, and my eyes lit up.  The title of the problem
>was “Endgame”.  You were given a chessboard as 8 lines of text to stdin (for
>example, rnbqkbnr for the first line).  The positions were guaranteed to be a
>mate-in-1.  You can ignore castling, en passant, and moving a pawn forward 2
>squares.  Print the position after the mating move.  Now, I think it would be a
>pretty safe bet that I knew more about chess programming than the other 30 or so
>contestants in the room combined.  I should have a huge advantage here.
>
>Silly me, instead of doing the easy question first, I immediately started coding
>the chess question.  15 minutes later I realized that the contest is first based
>on the number of questions you solve, and if there's a tie, the time you took,
>so I better just do the easy one first.
>
>I race through the magic square problem, print a sample problem, it doesn't
>work.  I quickly saw the error in my mental math and fixed it, which (somehow)
>made me only the 4th person to submit a correct answer up to that point.
>
>I spent the rest of the time working on the chess problem.  I had an almost
>working program with 50 minutes left of the original 2 hours, but I spent
>another 10 minutes figuring out why the IO didn't work.
>
>When you submit you answer, the system automatically tries several test cases.
>It indicated that my program crashed.  Strange.  Non of the test cases I tried
>caused a crash.  I tried using the Visual C++ debugger.  Unfortunately, the
>computers we were using were configured so that you can't debug a program unless
>you are an administrator.  Idiots.  The tournament director had no idea about
>this.
>
>I never figured out why the program was crashing.  But I finished in 4th,
>winning me a Visual Studio t-shirt, with a Napoleon Dynamite (stupidest movie
>ever) joke on the back.  I actually didn't read the other problems during the
>contest, because I was so determined to finish the chess question, but looking
>at them now, I think would have been able to do both (no one actually solved
>them).  As far as I can tell, the solutions to the other 2 questions are much
>much shorter, and not nearly as tedious.  The other problems are pretty cool,
>maybe I'll post the problems in CTF, if anyone is interested.
>
>So as I sit here dejected that I couldn't solve a problem I've spent years on,
>I'd like ask everyone this question:  How confident are you that you can 100%
>accurately write the solution to the chess question in less than 2 hours, under
>the pressure of competition, without the use of a debugger?
>
>Or am I just an idiot? :)

Nope.

I have written such a function for my chessprogram to evaluate a mate in 1
without search, and I can tell you for sure, nobody is going to get this correct
in 2 hours. There are too much traps.

to give you an idea:

The piece giving the checkmate shouldn't be pinned. Or attacked on the check
giving square, unless it's the opponent king or a pinned piece or a nonking
piece when it's a double check.

If contact mate, it should be defended, but that doesn't mean the square has to
be attacked twice...

If it's not a contact mate, there should be no opponent piece to place in
between unless that is pinned etc...

Actually, knowing it's a mate in one makes noncontact checkmates a bit easier.

Tony






This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.