Commit 68700cd0 authored by Johannes Bergmeier's avatar Johannes Bergmeier

- Removed class SKBase

- Moved fields from SKBase to SKPuzzle
- Removed files skbase.* and sudoku_solver.h

svn path=/trunk/KDE/kdegames/ksudoku/; revision=1119610
parent 6f4a0e44
......@@ -252,7 +252,7 @@ Game SudokuGame::startEmpty() const {
if(!m_solver) {
GraphSudoku *graph = new GraphSudoku(m_order);
graph->init();
m_solver = new skSolver(graph);
m_solver = new SKSolver(graph);
}
Puzzle* puzzle = new Puzzle(m_solver, false);
......@@ -265,7 +265,7 @@ Game SudokuGame::createGame(int difficulty) const {
if(!m_solver) {
GraphSudoku *graph = new GraphSudoku(m_order);
graph->init();
m_solver = new skSolver(graph);
m_solver = new SKSolver(graph);
}
Puzzle* puzzle = new Puzzle(m_solver, true);
......@@ -307,7 +307,7 @@ Game RoxdokuGame::startEmpty() const {
if(!m_solver) {
GraphRoxdoku *graph = new GraphRoxdoku(m_order);
graph->init();
m_solver = new skSolver(graph);
m_solver = new SKSolver(graph);
}
Puzzle* puzzle = new Puzzle(m_solver, false);
......@@ -320,7 +320,7 @@ Game RoxdokuGame::createGame(int difficulty) const {
if(!m_solver) {
GraphRoxdoku *graph = new GraphRoxdoku(m_order);
graph->init();
m_solver = new skSolver(graph);
m_solver = new SKSolver(graph);
}
Puzzle* puzzle = new Puzzle(m_solver, true);
......
......@@ -21,7 +21,7 @@
#include "ksudokugame.h"
#include "sudoku_solver.h"
#include "sksolver.h"
#include "puzzle.h"
......
......@@ -29,7 +29,7 @@
#include "ksview.moc"
#include "sudoku_solver.h"
#include "sksolver.h"
#include "puzzle.h"
#ifdef OPENGL_SUPPORT
......
......@@ -29,7 +29,7 @@
//Added by qt3to4:
#include <QWheelEvent>
#include <QMouseEvent>
#include "sudoku_solver.h"
#include "sksolver.h"
#include "ArcBall.h"
#include "ksudokugame.h"
......
......@@ -29,7 +29,7 @@
#include <kdebug.h>
#include "sudoku_solver.h"
#include "sksolver.h"
#include "puzzle.h"
#include "gameactions.h"
......
set(ksudoku_logic_SRCS
skgraph.cpp
skbase.cpp
skpuzzle.cpp
sksolver.cpp
puzzle.cpp
......
......@@ -22,7 +22,7 @@
#ifndef _KSUDOKUPUZZLE_H_
#define _KSUDOKUPUZZLE_H_
#include "sudoku_solver.h"
#include "sksolver.h"
#include "ksudoku_types.h"
class QChar;
......
/***************************************************************************
* Copyright 2005-2007 Francesco Rossi <redsh@email.it> *
* Copyright 2006 Mick Kappenburg <ksudoku@kappendburg.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "skbase.h"
#include <math.h>
void SKBase::setorder(int k, int threedimensionalf, int sized)
{
type = threedimensionalf;
order = k;
int base = (int) sqrt((double)order);
if(sized!=-1) size=sized;
else size = (type==1) ? base*base*base : (order*order) ;
}
/***************************************************************************
* Copyright 2005-2007 Francesco Rossi <redsh@email.it> *
* Copyright 2006 Mick Kappenburg <ksudoku@kappendburg.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef SKBASE_H
#define SKBASE_H
#define ITERATE(i,s) for(int ((i))=0; ((i))<((s)); ++((i)))
/**
@author
*/
class SKBase
{
public:
int order;
int size;
int type;
void setorder(int k, int type = 0, int sized=-1);
explicit SKBase(int i=9, int typef = 0,int sized=-1)
{setorder(i, typef,sized); }
};
#endif
......@@ -25,7 +25,6 @@
#include <vector>
#include <QBitArray>
#include <QVector>
#include "skbase.h"
#include "ksudoku_types.h"
......
......@@ -22,13 +22,21 @@
#include "skpuzzle.h"
//SKPuzzle::SKPuzzle()
//{
//}
//SKPuzzle::~SKPuzzle()
//{
//}
#include <math.h>
SKPuzzle::SKPuzzle(int oi, int typef, int sized)
// : SKBase(oi,typef,sized )
{
order = oi;
int base = (int) sqrt((double)order);
if(sized!=-1) size=sized;
else size = (typef==1) ? base*base*base : (order*order) ;
ITERATE(i, size)
{
numbers[i]=0;
ITERATE(j, order+1) flags[i][j]=1;
}
}
......@@ -22,28 +22,22 @@
#ifndef SKPUZZLE_H
#define SKPUZZLE_H
#include "skbase.h"
#define ITERATE(i,s) for(int ((i))=0; ((i))<((s)); ++((i)))
/**
@author
*/
class SKPuzzle : public SKBase
class SKPuzzle
{
public:
int order;
int size;
unsigned char numbers[625];
unsigned char flags[625][26];
explicit SKPuzzle(int oi=9, int typef = 0, int sized=-1) : SKBase(oi,typef,sized )
{
ITERATE(i,size)
{
numbers[i]=0;
ITERATE(j,order+1) flags[i][j]=1;
}
}
explicit SKPuzzle(int oi=9, int typef = 0, int sized=-1);
};
#endif
......@@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "sudoku_solver.h"
#include "sksolver.h"
#include <stdio.h>
// #include <cstdlib>
......
/***************************************************************************
* Copyright 2005 Francesco Rossi <redsh@email.it> *
* Copyright 2006 Mick Kappenburg <ksudoku@kappendburg.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef SUDOKU_SOLVER_H
#define SUDOKU_SOLVER_H
#include "sksolver.h"
typedef SKPuzzle skPuzzle;
typedef SKGraph skGraph ;
typedef SKSolver skSolver;
#endif
......@@ -26,7 +26,7 @@
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kconfigdialogmanager.h>
#include "sudoku_solver.h"
#include "sksolver.h"
#include "serializer.h"
#include <cstdlib>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment