Click here to Skip to main content
15,881,803 members
Articles / Desktop Programming / WPF

WPF Alien Sokoban

Rate me:
Please Sign up or sign in to vote.
4.88/5 (44 votes)
16 Jun 2008BSD9 min read 125.3K   3.4K   78  
A fun implementation of the game Sokoban, written to showcase some features of WPF, C# 3.0, Expression Design, and Visual Studio 2008.
/*	<File>
		<Author Name="Daniel Vaughan" Email="dbvaughan NOSPAM at NOSPAM gmail NOSPAM dot NOSPAM com"/>
		<CreationDate>2007/10/29 18:09</CreationDate>
		<LastSubmissionDate>$Date: $</LastSubmissionDate>
		<Version>$Revision: $</Version>
		<License>
Copyright © 2007, Daniel Vaughan
All rights reserved.
http://www.orpius.com

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Neither Daniel Vaughan, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior written 
permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGE.
		</License>
	</File>
*/

namespace Orpius.Sokoban
{
	/// <summary>
	/// Indicates the set of steps, or route,
	/// that an <see cref="Actor"/> will take
	/// to relocate to a destination on a <see cref="Level"/>.
	/// This is used in conjuction with <see cref="PathSearch"/>
	/// to locate a valid route between the <see cref="Actor"/>
	/// instance and the <see cref="Jump.Destination"/>.
	/// </summary>
	class Jump : MoveBase
	{
		/// <summary>
		/// Gets or sets the location of the destination
		/// for the jump.
		/// </summary>
		/// <value>The destination.</value>
		public Location Destination
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the route from an initial location
		/// to a predefined <see cref="Destination"/>.
		/// </summary>
		/// <value>The route to the predefined <see cref="Destination"/>.
		/// May be null.</value>
		public Move[] Route
		{
			get;
			private set;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Jump"/> class.
		/// </summary>
		/// <param name="destination">The destination of the jump. 
		/// <seealso cref="Destination"/></param>
		public Jump(Location destination)
		{
			this.Destination = destination;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Jump"/> class.
		/// Use to perform an undo.
		/// </summary>
		/// <param name="route">The route that was previously calculated.</param>
		public Jump(Move[] route)
		{
			Route = route;
		}
	}
}

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, along with any associated source code and files, is licensed under The BSD License


Written By
Engineer
Switzerland Switzerland
Daniel is a former senior engineer in Technology and Research at the Office of the CTO at Microsoft, working on next generation systems.

Previously Daniel was a nine-time Microsoft MVP and co-founder of Outcoder, a Swiss software and consulting company.

Daniel is the author of Windows Phone 8 Unleashed and Windows Phone 7.5 Unleashed, both published by SAMS.

Daniel is the developer behind several acclaimed mobile apps including Surfy Browser for Android and Windows Phone. Daniel is the creator of a number of popular open-source projects, most notably Codon.

Would you like Daniel to bring value to your organisation? Please contact

Blog | Twitter


Xamarin Experts
Windows 10 Experts

Comments and Discussions