Robocode – “Build the best – destroy the rest!”

This post is for all the geeks out there who’s crazy about programming battle robots. The program is Robocode!

In simple terms Robocode is a programming game. The game is all about programming a robot and battling with other robots. You can use JAVA or .NET for programming the battle robot. The Fun fact is that you can battle your robots with other opponents real-time and on-screen.

Robocode comes with its own installer, built-in robot editor & a Java compiler The only pre-requisite a JAVA installed operating system. One can also use his/her favorite IDE for the programming. Robocode comes to you as a free and an opensource software. So why wait. Be a Robocoder, Build the best & destroy the rest!

You can download the program here.

And also check the

for detailed information.

💡 Special Thanks goes to my friend Hansa Nanayakkara for sending me the link.

Have fun battling!! 😀

Advertisements

The ‘I-Game’: Answer

Hey guys!
Hope you can remember my previous post ” The ‘I-Game’ “ . In this post I like to share an answer for that problem. There can be many solutions for the problem but I found this neat piece of code while surfing the internet. Anyone whose interested in other problems & answers they can visit http://www.migids.com/ .  I have tested the code for the sample input and worked fine.

Enjoj ! 🙂


import java.util.Scanner;

public class ProblemS {

    static char[][] grid = new char[10][10];

    public static void main(String[] args) {

        // "turn off lights"
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                grid[i][j] = '.';
            }
        }

        String line = "";
        Scanner console = new Scanner(System.in);

        try {
            while (console.hasNextLine()) {
                line = console.nextLine();
                if (line == null || line.isEmpty()) {
                    break;
                }
                int[] coords = new int[2];
                coords[0] = Integer.parseInt(line.split(" ")[0]);
                coords[1] = Integer.parseInt(line.split(" ")[1]);

                // invert the coords as in document
                push(coords[1], coords[0]);
            }
        } catch (Exception e) {
        }

        // output the grid
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j <= 8; j++) {
                System.out.print(grid[i][j] + " ");
            }
            System.out.println(grid[i][9]);
        }
    }
    /**
     * Pushes the screwdriver on the target coordinates
     *
     * @param x
     * @param y
     */

    private static void push(int x, int y) {

        sw(x, y);
        sw(x - 1, y - 1);
        sw(x - 1, y);
        sw(x - 1, y + 1);
        sw(x + 1, y - 1);
        sw(x + 1, y);
        sw(x + 1, y + 1);
    }
    /**
     * Switches the light
     */
    private static void sw(int x, int y) {

        // check bound
        if (x > 10 || x < 0 || y > 10 || y < 0) {
            return;
        }
        if (grid[x][y] == '.') {
            grid[x][y] = 'X';
        } else {
            grid[x][y] = '.';
        }
    }
}

IEEEXtreme 4.0 @ MORA

ieeextreme 4.0

IEEEXtreme 4.0 organized by the IEEE concluded successfully today (2010-08-24) morning at 0530h local time. IEEEXtreme is a global challenge in which teams of IEEE student members compete in a 24-hour time span against each other to solve a set of programming problems.

The competition started on 2010-08-24 at 0530h local time (00:00 GMT). This year 37 teams registered for the competition from University of moratuwa. The team “beta” (Members: Varuna Parinda Jayasiri, Chethiya Abesinghe, Lalintha Gayan Polpitiya) has managed to secure the 11th place of the competition this year. Also the teams “Selachimorpha” and “SharpSharks” managed to reach top 50 in the competition.

Hats off for all the teams for the great effort they have given. Coding algorithms for 24 hours straight is not an easy task as it seems. The IEEE Student branch of University of Moratuwa was there with all the participants in the university giving them an immense support providing necessary facilities. So a BIG “THANK YOU” goes to them.

It was a great opportunity for me to take part in the organizing process of an event with that magnitude. And hopefully I’ll be and Xtremer for IEEEXtreme 5.0 !!! 😀