Submitted By: "Sliding Puzzle"
Submitted By: "Sliding Puzzle"
Micro Project On
“Sliding Puzzle”
Submitted by
7.Mahima Mogal
Under Guidance of
Mrs. J. C.Joshi
Sinhgad Institutes
Sinhgad Technical Education Society’s
SOU. VENUTAI CHAVAN POLYTECHNIC, PUNE - 411041
ACADEMIC YEAR 2023 - 2024
Maharashtra State Board of technical
Education Certificate
This is to certify that Miss. Mahima Mogal with Roll No.7 of Fifth
Semester of Diploma in Information Technology of Institute
Sou. Venutai Chavan Polytechnic (Code:0040) has successfully
completed the Micro-Project in Client Slide Scripting Language (22519)
for the academic year 2023-2024.
A. BRIEF INTRODUCTION:
In this project guides you in creating a sliding puzzle using HTML, CSS, and JavaScript. It's a
classic game where players rearrange pieces to complete an image. We'll start by building the puzzle
structure with HTML and then use CSS to make it visually appealing and interactive. JavaScript will
handle the game's functionality, like piece movement and win conditions. By the end, you'll have a
fully functional sliding puzzle game to incorporate into your website or app.
The project entitled “Sliding Puzzle” is aimed to study the Client Slide Scripting.
D.RESOURCES REQUIRED:
Name of Resource
Sr . No. Specification
Required
1 Laptop Intel (R) Core i7- 16GB RAM
2 Operating system Windows 11
3 Software Googlechrome,Notepad
3. ACTION PLAN:
GROUP MEMBERS:
JavaScript is limited featured client side programming language. JavaScript runs at the client end through
the user's browser without sending messages back and forth to the server. It is widely used by the web
developers to do things such as build dynamic web pages, respond to events, create interactive forms,
validate data that the visitor enters into a form, control the browser etc. This course helps student to create
highly interactive web pages using these features.
S. No Course Outcomes
A Create interactive web pages using program flow control structure.
…………………………………………………………………………………………………
7 Mahima Mogal
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Image Puzzle</title>
<script src="js/image-puzzle.js"></script>
</head>
<body>
<div id="collage">
<h3 id="imgTitle"></h3>
<hr />
<div id="actualImageBox">
<div id="stepBox">
<div>Steps:</div>
</div>
<div id="timeBox">
Time Taken: <span id="timerPanel"></span> secs
</div>
<div>Original Image</div>
<p id="levelPanel">
</p>
<div>
</div>
</div>
</div>
</div>
<div style="background-color: #e2cd30; padding: 5px 10px 20px 10px; text-align: center; ">
<br />
<br />
<div>
<button type="button" onclick="window.location.reload(true);">Play Again</button>
</div>
</div>
</div>
<script>
var images = [
];
window.onload = function () {
imagePuzzle.startGame(images, gridSize);
};
function restart() {
imagePuzzle.startGame(images, gridSize);
function rules() {
function about() {
</script>
</div>
</body>
</html>
Puzzle.css
#collage hr{
border:none;
height:1px;
#collage #playPanel {
background-color:#c2e4fc;
padding:10px 0px;
max-width:800px;
width:95%;
#collage #actualImageBox {
display: inline-block;
font-size:0.8em;
vertical-align: top;
width:280px;
display:inline-block;
width:48%;
}
background-color:#c0d9f4;
display:inline-block;
padding:1px 4px;
max-width:800px;
#collage img#actualImage{
height:280px;
width:280px;
#collage #sortable {
list-style-type: none;
display: inline-block;
margin: 10px;
padding: 0;
width: 400px;
#collage #sortable li {
border: none;
cursor: pointer;
margin: 0;
padding: 0;
float: left;
width: 100px;
height: 100px;
#collage button {
background-color:#f5f2f2;
display: inline;
font-size: 14px;
height: auto;
width: auto;
Puzzle.js
var timerFunction;
var imagePuzzle = {
stepCount: 0,
this.setImage(images, gridSize);
helper.shuffle('sortable');
this.stepCount = 0;
this.startTime = new Date().getTime();
this.tick();
},
tick: function () {
helper.doc('timerPanel').textContent = elapsedTime;
},
helper.doc('imgTitle').innerHTML = image.title;
helper.doc('actualImage').setAttribute('src', image.src);
helper.doc('sortable').innerHTML = '';
let li = document.createElement('li');
li.id = i;
li.setAttribute('data-value', i);
li.setAttribute('draggable', 'true');
let p = dest.parentNode;
//LEFT SWAP
p.insertBefore(origin, dest);
p.insertBefore(temp, origin);
else{
p.insertBefore(dest, origin);
p.insertBefore(origin, temp);
helper.doc('stepCount').textContent = ++imagePuzzle.stepCount;
if (isSorted(vals)) {
// helper.doc('actualImageBox').style.display = 'none';
// helper.doc('gameOver').style.display = 'block';
helper.doc('actualImageBox').innerHTML = helper.doc('gameOver').innerHTML;
helper.doc('stepCount').textContent = imagePuzzle.stepCount;
};
li.setAttribute('dragstart', 'true');
helper.doc('sortable').appendChild(li);
helper.shuffle('sortable');
};
isSorted = (arr) => arr.every((elem, index) => { return elem == index; });
var helper = {
var ul = document.getElementById(id);
ul.appendChild(ul.children[Math.random() * i | 0]);
}
OUTPUT :-