ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
Re: [Tutor] 15 puzzle (fwd)
by Sheila King other posts by this author
Apr 29 2001 12:51AM messages near this date
[Tutor] 15 puzzle (fwd) | [Tutor] 15 puzzle
On Sat, 28 Apr 2001 23:32:44 -0700 (PDT), Daniel Yoo
<dyoo@[...].edu>   wrote about [Tutor] 15 puzzle (fwd):

Here are the  contents of the MS Word document:

/*
  The 15 Applet.
  You can do whatever you want with the code. You can use it, modify it,
  delete it. You can even print it out and burn it, or you can burn it
  without printing it out, but then please do be very carefull, for I 
  heard that monitors, hard drives and computers in general don't behave
  well under high temperatures. Just don't hold me responsible if it does
  anything, um, not so good to your computer.

  There is one thing I do ask:
  This is my first Java effort, so I don't know the language very well.
  I'm almost sure that some things here are quite incorrect, even though
  they do work. Never mind the algorithms themselves, but if you do find
  anything that needs to be changed, please send me a message at
  eugene@[...].com Thank you.
*/
import java.applet.*;
import java.awt.*;
//--------------------------------------------------------------------------
public class fifteen extends Applet
{
   private SevenSegmentDigit[] display = new SevenSegmentDigit[3];
   private Button[] Buttons = new Button[16]; //This array is an actuall
playfield.
   private Button shuffleBtn = new Button ("&Shuffle");
   private int score=0;
   private int shuffling=0;						  
   private Font f;
/*---------------------------------------------------------------*/
	public String getAppletInfo() //Do I need this function?
	{
		return "Name: fifteen\r\n" +
		       "Author: Eugene\r\n" +
		       "Created with Microsoft Visual J++ Version 1.0";
	}

/*---------------------------------------------------------------*/
	public void init()
	{
		int i=0;
		String str=new String();

		resize(200, 300);
		setLayout(null); //Why do they bother so hard with layouts?
		setBackground(Color.black);

		for(i=0; i3)
					  moveBtn(empty-4);
				  return true;
		
		case Event.LEFT: if(empty % 4 !=3)
					  moveBtn(empty+1);
			      return true;

		case Event.RIGHT: if(empty % 4 != 0)
					  moveBtn(empty-1);
			      return true;

        case 's':
		case 'S': shuffle();
			      return true;
		}
	  return false;
	}
/*---------------------------------------------------------------*/
	public boolean action(Event evt, Object what)
	{
		int i=0;
	 
			for(i=0;i


--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Daniel Yoo
Sheila King

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved