b33angelova

Bashful and the Falling Rocks – JavaScript game

    Something small just for fun – here is a simple JavaScript game, called Bashful and the Falling Rocks. (I guess you all remember the sweetest dwarf of Snow White)
It was my first time “using” jQuery and actually even one of the very first things I’ve done with JS. The task was part of the first homework at the SoftUni Bulgaria JavaScript Basics course. I guess I’m going to improve the code in case I have the time to spend. Till then – it is still a good example of practices not to use 🙂
Bashful and the Falling Rocks – source code, demo

Leave a comment »

Graphs (A Brief Overview, Depth-First Search algorithm)

   This article is intended to be a slight introduction to graph theory and in particular to it’s applications in computer science. First thing’s first: what is a graph?
In mathematics the so called “graph” (not to be confused with a “diagram”) is in general a representation of a set of objects. Those objects are defined by mathematical abstractions called vertices (or nodes). Some of them can be connected by links, which in this article will appear under the name “edges”. The edges can have a direction and can be assigned with a particular weight.

   Graph theoretical ideas are highly utilized, especially in research areas such as networking, data mining, image segmentation, clustering, image capturing, etc. A few examples:
– modeling of network topologies can be done using graph concepts
– a data structure can be designed in the form of tree which in turn utilized vertices and edges
– the graph coloring concept can be applied in resource allocation, scheduling.
– and many, many more..
This leads to the development of new algorithms and new theorems that can be used in enormous applications. [1]
I will explain and provide a simple Java implementation of one of the easiest algorithms – the depth-first search of a directed graph.
Two last things you need to know before I begin are:
1. There are two main types of graphs: the undirected and the directed (depends on the type of the edges in the graph)
2. There are two main ways to represent a graph: by its adjacency matrix or by its adjacency list.

graphs

   The basic idea of the Depth-first search is to start at some arbitrary vertex* v and explore as far as possible along each branch. Once all of v’s edges have been explored, the search “backtracks” to look for edges leaving the vertex from which v was discovered. This process continues until we have all the vertices that are reachable from the original source vertex. [2]

   When the depth-first search has backtracked all the way back to the original source vertex v, it has built a DFS tree of all vertices reachable from that source. If there still undiscovered vertices in the graph then it selects one of them as the source for another DFS tree. The result is a forest of DFS-trees. The strategy the algorithm follows is to search “deeper” in the graph whenever it can achieve more vertices.

 Here is a picture better than any longer explanation:

dfs

   Depth-first search finds application as a building block of more complex algorithms including topological sorting, maze generation, puzzle solving, etc.
You can check the implementation my colleague Rene Rahn and I made a while ago:
GraphDFS

if we have a tree formed structure – we start at the root
Sources:
[1] Applications of graph theory, an overview. S.G.Shirinivas, S.Vetrivel, Dr. N.M.Elango
[2] Introduction to algorithms. T.Cormen
[3] Applications of graph theory. A.Dharwadker, S.Pirzada

Leave a comment »

Runepack Joyride – JavaScript game

Another team project at SoftUni behind.
Our assignment was to create a JavaScript game,running in the Internet. It was, confirmed, some hard work – but all forces together, and this is the result:
Runepack Joyride

game
If you want to take a look at the source code:
Runepack Joyride – GitHub repo

Leave a comment »

Socoban – Java Game

A month ago I took part at a teamwork project for the Java Basics course in SoftUni. Our job was to design and program a game.
Since the team name was Tion Cluster – a star cluster located within the Outer Rim region of the galaxy (Star Wars fans can relate) – my team decided to work on a remake of the classic game Socoban.


We were six people and we managed to work together amazingly well. Everybody was able to participate, learn new things and actually have fun while doing it.
I’d like to thank all my teammates and tell them I’ve been missing our work together.

You can check out our end-result here: Socoban Game

Greetz!

Leave a comment »

Java Calculator

A couple of years ago (2012) I had this assignment to implement a calculator with GUI in Java.
That was the first moment I came across the NetBeans IDE, which actually saved my situation.The best thing about NB is the opportunity to build simple GUIs without the slightest skill in the Java programming language.*  Image

 

When I look at it now, I find the whole design absurd. Still, it happened to be a job well done.

GrafOb.java
DisplayNumber.java

The both classes work together.
Feel free to use and improve the code.

*it is not an IDE I would recommend for beginners, because of the automatically generated code. In my opinion, it does not help learning the whole logic behind GUI building.

Leave a comment »

Bugs Against Monkeys – Java game

Here goes my try of creating a text-based game in Java.

The game is called Bugs Against Monkeys and it’s a lower quality remake of Battleship/Minesweeper (without hints).

I’m using two 2D-arrays to save :

  1. The board to print, from which the players pick 2 coordinates of a point in which they suggest a bug/monkey is hidden;
  2. The array with animals, which has the same length as the board array. The difference is that it’s filled with a couple of bugs on the left side and couple of monkeys on the right side, otherwise 0s.

The sizes of the board can be changed.
Feel free to use and improve the code.

BugsAgainstMonkeys.java

1 Comment »

MergeSort Implementation

Merge sort is one of the most common divide-and-conquer sorting algorithms, known in the computer science.
Here it is, explained in three main steps:

  •  divide a list into two equal (+-1) sized smaller lists;
  • sort each smaller list recursively;
  • merge the two sorted lists to get one sorted list.

Image

Here is a link of an old implementation, written by me and my former project partner in Algorithms and Databases, René Rahn.

Merge.java ;

MergeSort.java .

Recommended book for interested: Introduction to Algorithms by T. Cormen, C. Leiserson, R.Rivest, C. Stein.

Leave a comment »

Leading Trends -or- Eurovision Song Contest 2014

Leave a comment »

Design a site like this with WordPress.com
Get started