1337, The saga continues...

Published June 16, 2005
Advertisement
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" Cortesusing 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!!!!!
Previous Entry (Sigh)...
Next Entry T3H W0RK111!!11!1
0 likes 3 comments

Comments

Neoforce
Good stuff. You should try a switch statement instead of all those 'if-else' statements.
June 16, 2005 09:42 PM
Mushu
Focus on SDL roxxors. You can maek 1335 stuff with SDL. Li3K:



[/4E4 plug]
June 16, 2005 09:47 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement