Game development with RUBY

July 21st, 2009


We were fascinated when we developed a 9*9 sudoku puzzle game since everyone enjoy solving sudoku puzzles that comes in the daily newspaper. But then writing code for creating one is not going to be a smooth job. Initially, we started working out a 3*3 sudoku algorithm to generate an 2-dimensional array of 3 rows and 3 columns that has numbers 1,2 and 3.

Each cell is inserted with a random number from 1 to 3 that satisfies the condition that the numbers is not occured in the same row and the same column. A 3*3 solution matrix was successful with little logic. Next is to generate a 9*9 pack of numbers that forms a sudoku table. The former algorithm can be reengineered? There came the real puzzle. A 9*9 sudoku grid is divided into 9 - 3*3 boxes and the conditions for inserting the random values into the 9*9 2-dimensional array is increased by 1.

  • The values in each of the rows must be unique.

  • The values in each of the columns must be unique.

  • The values in the each of the boxes must be unique as well.

Eventually the code was satisfied by 3 methods that check the above 3 conditions respectively and got the 9*9 array of sudoku solution matrix. The most wanted 3 methods are:

#Method to check the elements in a row are unique

def rowcheck(rand,row)
for i in 0…$array1.length
if($array1[row][i]==rand)
return false
else
next
end
end
return true
end

#Method to check the elements in a col are unique

def colcheck(rand,col)
for i in 0…8
if($arr1[i][col]==rand)
return false
else
next
end
end
end

#Method to check the elements in boxes are unique

def boxcheck(rand,row,col) #The condition has to be checked for each boxes
if(row<3 and col<3) #Box1
for i in 0..2
for j in 0..2
if($arr1[i][j]==rand)
return false
else
next
end
end
end
end

The random number that passes through all the 3 checking methods will have to be assigned into the array. Yippee! finally, the sudoku table was generated.

Then the left over task is the GUI part which is fulfilled by  effective GUI toolkit, Ruby Tk. The  puzzle ended with a sudoku grid that displays few values from the source array that is been generated by the code and allows the user to fill the rest of the cells (using event handling). Each cell in the grid holds a button and when the user clicks a button, it waits for the input from the keyboard. The number is assigned to the button once the user presses the right number that corresponds to the sudoku table.

-Ruby Team

Motivation

July 9th, 2009

Motivation is a force that creates behavior to fulfill a need. It is not necessarily Positive or negative, Fulfilling or frustrating/ It can be all some or none of these.When we say motivation, an image springs to mind of coach giving his team a fiery pep talk of a sales manager rallying his sales force of a marathon runner setting out to train on the coldest day of the year. However Motivation is not just about heroic feats of positive action.

People can also be motivated to take negative actions.Someone can be motivated to commit a crime, overthrow authority. This is a darker side of human motivation. Motivation is a powerful and complex force that causes us to act.One behaviour can have many possible motives. For instance , a man can be motivated to exercise because he wants to look more muscular, because he is under a lot of stress, because he wants to Socialise more, because he is training for an athletic event, because he likes to feel healthy, because he wants to lose weight, because he wants to meet women interested in fitness or simply because he likes exercising.

Thus Motivation Plays a vital role in every aspect to fulfill a wish or responsibility.

- Aparna Lakshminarayanan

Journalism and its Importance

July 1st, 2009

Journalism refers to the delivery of of reports and editorial through varous media which includes newspapers, magazines, TV, Radio, Internet, Hoardings and so on. Any news from across the world reaches people immediately in just few seconds or minutes. That world has advanced so because of Journalism and off course Journalists.

Internet plays a major role compared to any media, because it publishes the news online, once the incident occurs. Even Television does in telecasting the news online. Many news Channels have come across now to produce the prompt information to the people, but still it is in a position to act according to the politicians rule.

Journalism not only receives the news and reports, but also analyses it before reporting it for the news to be published.It includes “what, where, when, why and how” for any news and how many ever times , it is broadcasted, telecasted or published for any person to understand the actual news.It is not an easy & simple task to conclude this, as it has many categories in it too. They are crime Journalism, Investigation Journalism, Political Journalism, Sports Journalism, Film Journalism and so on. Each catogery has its own importance in giving a useful news to the spectators. When we say crime and investigation Journalism, it is interrelated and could also be told it is dependant on each others.When there’s any crime occuring in city, that is not only the news to be collected and reported for the news to be published immediately, but should also investigate or analyse on where the incident happened, why has it happened, when has it happened, who are included in it and how has it happened? When we come to Political, It just includes all politics related stuffs in it.Sports Journalism means just the sports news getting publshed , telecasted or broadcasted. Film Journalism is also the same way dedicated only for the film news.

So any segment has its own importance to give it to the public.

- Aparna Lakshminarayanan

IT’s Impact on Chennai

June 24th, 2009


Chennai is always different , when compared to other cities in India. This cosmopolitan city’s population and craze has increased due to the boon of IT and many IT parks, that it brings many people from outside state & Country. Though being a cosmopolitan city, it is also famous for its own Tradition.

When we say, it is both modern and Traditional, On one side it has all th IT parks , Star Hotels, Disco Theqs , Multiplex Theaters and off course people are too well developed & Educated, and even ont he other side. It also gives more importance to Calssical Dance & carnatic Music, that at the tamil month of Margazhi, many Music & Dance Concerts by famous musicians 7 Dancers occur. Kalakshetra is a well known cultural school for dance and Music, where people from different towns, states and even countries do their studies here.

Chennai is also familiar for its kollywood , Tamil movie industry, It is called so because, most of the movie studios are located at kodambakkamMajority of the chennaiites are Tamilians. When we say cosmopolitan , it even has all other state people such as, Telugu, kannada, Malayam, Hindi , Marati and so on.

But all the developments and advancements in this city have come due to many IT sectors & Multi National Companies , which have made a greater impact on Chennai Standarad and Cost of living.

- Aparna Lakshminarayanan

GUI (Graphical User Interface with Ruby) applications with Ruby (or) Desktop Applications with Ruby

June 23rd, 2009

We can build desktop applications with Ruby. Looks Strange! Yeah, please go ahead and read the following.

There is a huge collection of GUI bindings for Ruby that allows to work with a wide variety of GUI toolkits. As a beginner, it took 1 solid day to study about the toolkits in Ruby and install one of them. Apart from most of the toolkits that are intended to be used by C or C++ developers, the most common toolkits that are used widely are,

  • Ruby/Tk
  • FXRuby
  • WxRuby
  • QTRuby

Ruby/Tk is found to be the primitive GUI toolkit in Ruby. I felt easy to install it, since we  use Linux. On windows OS, ActiveTcl have to be downloaded and one-click installer has to be performed(Not a big deal).

How to start with Ruby/Tk?

Ruby/Tk works along a composition model. That is we start by creating a container such as TkRoot and TkFrame and then widgets are created and added to the container. Once you are done with it , Tk.mainloop must be invoked (mandatory for every Tk code).

My first Tk application:

Obviously “Hello world” was my first application. Eventually , I tried out the examples in the different tutorials which i felt difficult to understand. However, I started to implement the search-engine program (previously written by 3 of us) using Tk. It ended up with a Tk application that gets a directory name and displays various available files of the directory in it.

require “tk”

$i=0

$arr=Array.new

def search(path)                                                #method that performs search

Dir.foreach(”/#{path}”)do |item|                     #iterates with files and directories for the path

if File.directory?(”/#{path}/#{item}”)&& item!=’..’&& item!=’.’

filename=path +”/” +item        #if directory, adds the name to the path

search(filename)                      #recursion of search method with new directory

else

if item!=’..’&& item!=’.’

$i=$i+1

$arr[$i]=item               #assigns filenames are to an array

end

end

end

end

puts “Enter the directory name:”

dir=gets.chomp!                                              #Retrieves the directory name

search(”home/jesudian/#{dir}”)                     #Calling the method with the path

arr1=TkVariable.new($arr)                              #The array variable is stored as a TkVariable

root = TkRoot.new                                         #Creates a container

root.title = “Window”

list = TkListbox.new(root) do                                     #Creates a listbox

listvariable arr1

pack(’fill’ => ‘x’)

end

list.place(’height’ => 150,                                #aligns the listbox

‘width’  => 150,

‘x’      => 10,

‘y’      => 10)

scroll = TkScrollbar.new(root) do                   #adds scrollbar to the list box

orient ‘vertical’

place(’height’ => 150, ‘x’ => 160)

end

list.yscrollcommand(proc { |*args|

scroll.set(*args)

})

scroll.command(proc { |*args|

list.yview(*args)

})

Tk.mainloop

After trying out this, I got a clear outline about API’s in Ruby/Tk. This toolkit consists of a grand selection of widget classes and modules. One common mistake that I came across while writing a Tk application is that I forget to call main loop method.

To conclude with, Ruby GUI can be used to write more powerful application that includes efficiency and modularity.

- Ruby Team.

Human Resources Development

June 16th, 2009

The Human Resources Development includes a lot of functions, and one among the important role is about the need of resources the company has and whether to outsource candidates or recruit employees to meet up the requirements, training the employees , ensuring they are highly qualified and the best fit for the requirement, It also includes managing the employees benefits and compensation, employee records and the personnel policies. These are always important for any organization to maintain a smooth and long lasting run of the company and for both the employers and Employees

Recently all the organizations including small, medium sized and in the bigger ones,HR Department is considered a major onefor running the office. It also plays a key role in Recruting, training and managing employees, so that the employees and the organization will have the best capability to meet up the requirements and give a high productivity.

- Aparna Lakshminarayanan

Usability and Visual appeal

June 10th, 2009

Usability and visual appeal always struggles to go hand in hand (I am talking about Usability not UX). We always have to compromise Usability or visual appeal to get the best of both worlds. Now the million dollar question is which should be given more importance ease of use or good on eyes. Even I don’t know the answer, but I feel no one need to know it. I use little common sense thinking what the business objective needs at that point.

Classic example on the both the cases. In a social networking website we have a place where user has to select tags for each object they add. Since tags are inter related and it’s always best to put it linearly. But it didn’t look good. Look of it didn’t persuade users to add objects if the first place. We have to give up usability for the looks.

Other place it was a Rich internet application(RIA), It was a very costly decision to take, The Entire application was done in White base. RIA was a designing tool and had lots to do with artistic values.  We found that black base will enhance usability of the users. We made that change. It increased 15% of the developing time but we believe it will increase usability by 20%.

Thank you for reading patiently.

Employers Vs Employees

June 9th, 2009

Why do employers need to concentrate so much on the personal information of the employees? Here we say, any employee is a representative of their company and the concerned behaviourstions do reflect on the employer’s Image in the makret. In Fact any company or organization isjudged by the employees behaviour int he organization.

It is always acceptable and even advisable for an employer to safeguard the reputation and security of the organization, by doing so. That the brand and image getting spoilt by any wrong employee can be stopped. Every company will have its own Policies and proceedures for the employees to follow. Any new employee should read through and sign the agreement, before starting with their first day of work in the new concern. It is good, beetter and best for both the employers and employees to have a smooth inter-relationship

We should always agree and do so, that employees are the pillars of any organization. If any Pillar of the building is damaged, the whole building is also damaged. The same will apply for the Employees. So every employee should understand their importance and responsibility as a pillar to build-up a strong organization.

- Aparna Lakshminarayanan

Benefits of User Experience (UX)

June 4th, 2009

UX gives a array of benefits, people know few benefits but there is lots of other advantages connected to it. I will try to illustrate few in this blog but its just a tip of the iceberg.

As every one know applying UX will increase Usability which is making the software more user friendly, effortless to use and making it look beautiful.There is array of other benefits you can get out of it.

  • Increase Sales but positioning correctly
  • Convert visitors into customers
  • Cross sell products
  • Reduce sales cycle

These might seem very wired but UX can by exploiting 3 fundamental things Persuasion, Emotion and Trust. Through these things we can take control of users senses and guide them in our path.

Simple illustration, Every one who used dell computer would come accorss this.

When Dell puts someting as Best Value,  what does it mean just thinnk…….?

If you see it clearly what ever he puts as best value will always be costly :) . Next time when you use dell website please look for it.

Hope this would have be little informative, Thank you.

——
Vijay
User Experience Group

Office Management and Administration

June 1st, 2009

When you say “office management” it includes the performance of work that is confidential related to any department or division in the office. It acts as a good support to the Top management. Any organisation or institution cannot be run without the administration part . It plays a vital role for any technical or non techniocal organisation.It also provides good Policies & proceedures for the company and Management. Irrespective of small or medium sized concern, administrative department is very essential for the company to have a long run. It includes Budget Planning & Implementaion for the forth coming year, Purchase of any any office equipment, Office Employees Attendance & Leave Maintanence, facilities Managemnt, records management, Travel Management and so on. It is the sole responsible part to build a healthy office and mangement.

     

An administrative manager is responsible for planning, controlling and organizing the clerical activities of the organization. It includes also the other important operation for the industrial establishment.

- Aparna Lakshminarayanan