Sudoku

Omdat het niet altijd over mountainbike hoeft te gaan...... Zet een boompje op over alles wat NIET met mountainbike te maken heeft maar hou het wel deftig.
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: GetDateTime.h
// Date: 17 December 2006.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "n4.h"

__declspec(dllimport) extern pascal void GetDateTime(pc_n4 secs);
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: GrafPort.h
// Date: 10 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "n1.h"

struct GrafPort;
    typedef GrafPort* p_GrafPort;
    typedef const p_GrafPort cp_GrafPort;
typedef const GrafPort c_GrafPort;
    typedef c_GrafPort* pc_GrafPort;
    typedef const pc_GrafPort cpc_GrafPort;
typedef GrafPort& r_GrafPort;
typedef p_GrafPort& rp_GrafPort;
typedef cp_GrafPort& rcp_GrafPort;
typedef c_GrafPort& rc_GrafPort;
typedef pc_GrafPort& rpc_GrafPort;
typedef cpc_GrafPort& rcpc_GrafPort;

// opm: hoe een GrafPort er uitziet interesseert ons hier niet.

struct GrafPort
    {
    n1 x[108];
    };
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: InitFonts.h
// Date: 10 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

__declspec(dllimport) extern pascal void InitFonts();
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: InitGraf.h
// Date: 10 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "void.h"

__declspec(dllimport) extern pascal void InitGraf(p_void globalPtr);
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: InitWindows.h
// Date: 10 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

__declspec(dllimport) extern pascal void InitWindows();
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: Lijst.h
// Date: 24 December 2006.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "orde.h"

struct Lijst;
    typedef Lijst* p_Lijst;
    typedef const p_Lijst cp_Lijst;
typedef const Lijst c_Lijst;
    typedef c_Lijst* pc_Lijst;
    typedef const pc_Lijst cpc_Lijst;
typedef Lijst& r_Lijst;
typedef p_Lijst& rp_Lijst;
typedef cp_Lijst& rcp_Lijst;
typedef c_Lijst& rc_Lijst;
typedef pc_Lijst& rpc_Lijst;
typedef cpc_Lijst& rcpc_Lijst;

struct Lijst               // 18 bytes nodig.
    {
    n1 index;              // 5 bits nodig.
    n1 aLeeg;              // 4 bits nodig.
    n1 leeg[puzzelGrootte];// 9 bytes nodig.
    bool gewijzigd1;       // 1 bit nodig.
    n1 volgende1;          // 5 bits nodig.
    bool gewijzigd2;       // 1 bit nodig.
    n1 volgende2;          // 5 bits nodig.
    n2 mogelijk;           // 9 bits nodig.
    };
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: Link.h
// Date: 6 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

// opm: de volgende definities mogen willekeurig veranderd worden.

#define DEBUG false
#define PROFILE_ALLES false
#define PROGRESSIE true
#define STANDAARD_C_CONSOLE_APP false
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: MaakTestPuzzels.cp
// Date: 14 Januari 2006.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#include "TestProgramma.h"

#include "collect.h"
#include "Debug.h"
#include "noErr.h"
#include "ProfilerDump.h"
#include "ProfilerInit.h"
#include "ProfilerTerm.h"
#include "Progressie.h"
#include "RandomGenerator.h"
#include "TestSnelheid.h"
#include "timeBase.h"

#if PROFILE_ALLES
    #pragma profile on
#endif

bool LosPuzzelsMet32CijfersOp(c_n4 aPuzzels)
{
    if (progressie)
        {
        Progressie::Herbegin();
        }
    c_n1 aIngevuldeVakken=32;
    c_n1 aLegeVakken=aVakken-aIngevuldeVakken;
    for (n4 i=0;i<aPuzzels;i++)
        {
        if (progressie)
            {
            if (Progressie::ErIsEenSecondeVoorbij())
                {
                Progressie::Schrijf(i);
                }
            }
        Buffer oplossing;
        oplossing.MaakRandom();
        Buffer opgave;
        oplossing.Schrap(aLegeVakken,
                         opgave);
        Puzzel puzzel;
        if (!LosPuzzelMet32CijfersOp_MEET(puzzel,
                                          opgave))
            {
            return false;
            }
        Buffer uitvoer;
        puzzel.Schrijf(uitvoer);
        if (!uitvoer.IsOplossing())
            {
            return false;
            }
	    Debug::StartUitvoer();
        opgave.Java_Dump();
        window.Schrijf("\p,");
        window.SchrijfLn();
	    Debug::StopUitvoer();
        }
    return true;
}

#if not PROFILE_ALLES
    #pragma profile on
#endif

bool LosPuzzelMet32CijfersOp_MEET(r_Puzzel puzzel,
                                  rc_Buffer opgave)
{
    c_bool isOpgelost=puzzel.LosOp(opgave);
    return isOpgelost;
}

bool Puzzeltest()
{
    if (debug)
        {
        Debug::Init();
        }
    Puzzel::Init();
    c_bool isOpgelost=LosPuzzelsMet32CijfersOp(100);
    return isOpgelost;
}

#if not PROFILE_ALLES
    #pragma profile off
#endif

int main()
{
    z2 err=::ProfilerInit(collectDetailed,
                          bestTimeBase,
                          static_cast<z2>(1000),
                          static_cast<z2>(100));
    if (err!=noErr)
        {
        return 0;
        }
    if (progressie)
        {
        Progressie::Init();
        }
    Init_Coordinaten();
    if (true)
        {
        if (!Puzzeltest())
            {
            if (debug)
                {
                window.Schrijf("\pTest is mislukt.");
                window.SchrijfLn();
                }
            }
        }
    err=::ProfilerDump("\p:Profiel:Sudoku profiel");
    if (err!=noErr)
        {
        return 0;
        }
    ::ProfilerTerm();
    return 0;
}
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: MaakTestPuzzels.h
// Date: 14 Januari 2006.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "n4.h"
#include "Puzzel.h"

bool LosPuzzelsMet32CijfersOp(n4 aPuzzels);
bool LosPuzzelMet32CijfersOp_MEET(r_Puzzel puzzel,
                                  rc_Buffer opgave);

bool Puzzeltest();

// opm: "z4 main" is niet ANSI strict volgens mijn compiler.
int main();
Gebruikersavatar
Puzzle
Mountainbiker
Berichten: 178
Lid geworden op: za 19 aug 2006 11:15
Rijdt met: MBK Super Sprint

Bericht door Puzzle »

Code: Selecteer alles

// File: MoveTo.h
// Date: 10 Januari 2007.
// Version: 197 microseconds on PowerMac G3/233 MHz.
//
// Copyright (c) 2006 Cliff Huylebroeck. All Rights Reserved.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for NON-COMMERCIAL purposes and without
// fee is hereby granted provided that this copyright notice
// appears in all copies.
//
// Cliff Huylebroeck MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
// SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// a PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Cliff Huylebroeck SHALL NOT
// BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

#pragma once

#include "z2.h"

__declspec(dllimport) extern pascal void MoveTo(z2 h,
                                                z2 v);
Plaats reactie