A quick and dirty implementation of Sokoban with JavaScript

A quick and dirty implementation of Sokoban with JavaScript

As part of my preliminary work for a Sokoban implementation in Scala, I decided to make a quick and dirty implementation using HTML, CSS and JavaScript.

There is no shortage of Sokoban implementations. One of the most famous implementations is known as Sokoban YASC. The acronym stands for “Yet Another Sokoban Clone.”

And there’s already at least one implementation of Sokoban on the Web using JavaScript: game-sokoban.com, which I play fairly regularly. I don’t know who programmed that one.

As part of my preliminary work for a Sokoban implementation in Scala, I decided to make a quick and dirty implementation using HTML, CSS and JavaScript.

The basic concept of a Sokoban level is quite easy to understand: you move the boxes so every box is on a goal.

Figuring out the specific steps to solve a particular level, that can be quite difficult, especially if there are some boxes already on goals and you must move them out before you can move the others in.

Sokoban levels are often grouped into sets. Presumably the first level of a set is easy. If you solve it, you go on to the second level, which is perhaps slightly more difficult.

For my JavaScript implementation, I decided I would only use “vanilla” JavaScript. If you want to follow along, you don’t need to NPM install a hundred different libraries. I’m not even going to use jQuery.

If you like, you can refer to my GitHub repository. To enable you to play the game in your Web browser without having to pull the repository, it has a gh-pages branch.

ascii javascript sokoban

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

Data Types In JavaScript

JavaScript data types are kept easy. While JavaScript data types are mostly similar to other programming languages; some of its data types can be unique. Here, we’ll outline the data types of JavaScript.

JavaScript Memory Management System

The main goal of this article is help to readers to understand that how memory management system performs in JavaScript. I will use a shorthand such as GC which means Garbage Collection. When the browsers use Javascript, they need any memory location to store objects, functions, and all other things. Let’s deep in dive that how things going to work in GC.

Create a Line Through Effect with JavaScript

In this post we are going to create an amazing line through effect, with help of CSS and lots of JavaScript. So, head over to your terminal and create a folder LineThroughEffect. Create three files -index.html, main.js and styles.css inside it.

Grokking Call(), Apply() and Bind() Methods in JavaScript

In this article, we will have a look at the call(), apply() and bind() methods of JavaScript. Basically these 3 methods are used to control the invocation of the function.