Click here to Skip to main content
15,892,161 members
Articles / Desktop Programming / MFC

Solitaire Puzzle with Backtracking

Rate me:
Please Sign up or sign in to vote.
4.26/5 (9 votes)
10 Sep 20056 min read 80.3K   2.7K   33  
A program to play Solitaire puzzle and to seek solutions using backtracking.
/*=============================================================================

	Dialog for setting search parameters

	This file is part of Solitaire Puzzle

	Copyright � 2000 Paolo Martinoli

	LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
	You may copy and distribute verbatim or modified copies of this source
	code in respect of the following conditions:
	-  you must keep intact this notice and all the other notices that refer
	to the copyright of the author and to the absence of any warranty;
	-  you must cause the modified files to carry prominent notices stating
	that you changed the files and the date of any change.

	This program is distributed "AS IS" WITHOUT WARRANTY OF ANY KIND, either
	express or implied, including, but not limited to, the implied warranties
	of merchantability and fitness for a particular purpose.

	For comments, questions or suggestions please write to:
	Paolo Martinoli
	pmartinoli@programmer.net
	Via Valsolda, 169 - 00141 Rome (Italy)

=============================================================================*/

#include "stdafx.h"
#include "SearchParamDlg.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


BEGIN_MESSAGE_MAP(SearchParamDlg, CDialog)
	//{{AFX_MSG_MAP(SearchParamDlg)
	ON_WM_HELPINFO()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


SearchParamDlg::SearchParamDlg(CWnd* pParent) : CDialog(SearchParamDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(SearchParamDlg)
	//}}AFX_DATA_INIT
}

void SearchParamDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(SearchParamDlg)
	DDX_Control(pDX, IDC_SLIDER_SHIFTDIR, m_sliderShiftDir);
	//}}AFX_DATA_MAP
}


BOOL SearchParamDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_sliderShiftDir.SetRange(0, 3);
	m_sliderShiftDir.SetPos(m_shiftDir);

	return TRUE;
}

void SearchParamDlg::OnOK() 
{
	m_shiftDir = m_sliderShiftDir.GetPos();
	
	CDialog::OnOK();
}

BOOL SearchParamDlg::OnHelpInfo(HELPINFO* pHelpInfo) 
{
	switch (pHelpInfo->iCtrlId)
	{
		case IDC_SLIDER_SHIFTDIR:
		case IDC_STATIC_SHIFTDIR:
			AfxMessageBox("This simply changes the order in which moves are tried.  If the search doesn't come to an end, try to change this parameter and start again.", MB_ICONINFORMATION);
	}
	
	return TRUE;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) Avventure nel Mondo
Italy Italy
I have a degree in Computer Science and I've been earning my living since the early 90s by making the compiler dance.

I was born in Milan in 1963 and live in Rome since 1995.

In my spare time I sing in a vocal ensemble and play guitar and keyboard. Unfortunately, I program much better than I play. Occasionally I coordinate travel groups for the Italian tour operator Avventure nel Mondo.

https://www.paolomartinoli.it
programmer@paolomartinoli.it

Comments and Discussions