Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    686
  • comments
    1952
  • views
    387781

1337, The saga continues...

Sign in to follow this  
Stompy9999

150 views

I've rewrittin my 1337 translator in C# and NeoSwiff, and embedded the Flash file in a web page. You can try it here.

The code needs to be optimized, but as of now, this is it:

// Translator from Normal speak to 1337 Speak
// By Joseph "Stompy" Cortes

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;



namespace leet_translator
{
// Application form
public class MyForm : System.Windows.Forms.Form
{
// Translator button
private System.Windows.Forms.Button button = null;
// Textbox for normal speak
private System.Windows.Forms.TextBox normal_text;
// Textbox for 1337 speak (read-only)
private System.Windows.Forms.TextBox leet_text;

// Constructor
public MyForm()
{
InitializeComponent();

}

// Initialize Application component
private void InitializeComponent()
{
this.SuspendLayout();

// Create normal speak box
this.normal_text = new System.Windows.Forms.TextBox();
this.normal_text.Location = new System.Drawing.Point(10, 10);
this.normal_text.Size = new Size(300, 100);
this.normal_text.Multiline = true;
this.normal_text.Text = "";
this.normal_text.ScrollBars = ScrollBars.Both;
this.Controls.Add(this.normal_text);

// Create tranlator button
this.button = new System.Windows.Forms.Button();
this.button.Location = new System.Drawing.Point(normal_text.Left, normal_text.Bottom + 10);
this.button.Text = "Translate";
this.button.Click += new EventHandler(on_click);
this.Controls.Add(this.button);

// Create 1337 speak box
this.leet_text = new System.Windows.Forms.TextBox();
this.leet_text.Location = new System.Drawing.Point(button.Left, button.Bottom + 10);
this.leet_text.Size = new Size(300, 100);
this.leet_text.Multiline = true;
this.leet_text.Text = "";
this.leet_text.ScrollBars = ScrollBars.Both;
this.Controls.Add(this.leet_text);

this.Text = "MyForm";
this.ResumeLayout(false);
}

// Click event
private void on_click(object sender, EventArgs e)
{
string normal = this.normal_text.Text;
string leet = "";
// Translate normal text
for(int i = 0; i < normal.Length; i++)
{
char c = normal;

if(c == 'a' || c == 'A') leet += "@";
else if(c == 'b' || c == 'B') leet += "8";
else if(c == 'c' || c == 'C') leet += "[";
else if(c == 'd' || c == 'D') leet += "[)";
else if(c == 'e' || c == 'E') leet += "3";
else if(c == 'f' || c == 'F') leet += "|=";
else if(c == 'g' || c == 'G') leet += "6";
else if(c == 'h' || c == 'H') leet += "#";
else if(c == 'i' || c == 'I') leet += "!";
else if(c == 'j' || c == 'J') leet += ";";
else if(c == 'k' || c == 'K') leet += "|<";
else if(c == 'l' || c == 'L') leet += "1";
else if(c == 'm' || c == 'M') leet += "^^";
else if(c == 'n' || c == 'N') leet += "N";
else if(c == 'o' || c == 'O') leet += "0";
else if(c == 'p' || c == 'P') leet += "P";
else if(c == 'q' || c == 'Q') leet += "9";
else if(c == 'r' || c == 'R') leet += "|2";
else if(c == 's' || c == 'S') leet += "5";
else if(c == 't' || c == 'T') leet += "7";
else if(c == 'u' || c == 'U') leet += "|_|";
else if(c == 'v' || c == 'V') leet += "V";
else if(c == 'w' || c == 'W') leet += "W";
else if(c == 'x' || c == 'X') leet += "><";
else if(c == 'y' || c == 'Y') leet += "%";
else if(c == 'z' || c == 'Z') leet += "2";
else leet += c;

}

this.leet_text.Text = leet;

}




static void Main()
{

Application.Run( new MyForm() );
}
}
}



I'm still getting used to the language, but it is pretty cool so far.

Oh, and Focus on SDL arrived today. PAARRTTYYYY!!!!!
Sign in to follow this  


3 Comments


Recommended Comments

Good stuff. You should try a switch statement instead of all those 'if-else' statements.

Share this comment


Link to comment
Focus on SDL roxxors. You can maek 1335 stuff with SDL. Li3K:



[/4E4 plug]

Share this comment


Link to comment
Guest Anonymous Poster

Posted

Try using
string.ToLower();
and
string.Replace("a","@");

Much faster :-)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!