X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fknight.c;h=f9ba1dc25bf083ea9ee73cdd40f5af87fec9c48c;hp=0e091f46dfa50e54fdcde54120e04180bad4c0c2;hb=c04d54322f7835ed42e597967d8fa5471025fcac;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/test/knight.c b/test/knight.c index 0e091f46..f9ba1dc2 100644 --- a/test/knight.c +++ b/test/knight.c @@ -1,3 +1,30 @@ +/**************************************************************************** + * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ /* * Knight's Tour - a brain game * @@ -6,11 +33,9 @@ * Eric S. Raymond July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.25 2002/06/29 23:32:18 tom Exp $ + * $Id: knight.c,v 1.28 2008/08/03 23:04:26 tom Exp $ */ -#include - #include /* board size */ @@ -358,7 +383,7 @@ drawmove(chtype tchar, int oldy, int oldx, int row, int column) mark_possibles(oldy, oldx, ' '); } - if (row != -1 && column != -1) { + if (row >= 0 && column >= 0) { markcell(trail, row, column); mark_possibles(row, column, minus); board[row][column] = TRUE;