toys/vtk2-pld/trunk/vtk2.cpp

shadzik cvs at pld-linux.org
Sat Aug 5 17:45:34 CEST 2006


Author: shadzik
Date: Sat Aug  5 17:45:33 2006
New Revision: 7597

Modified:
   toys/vtk2-pld/trunk/vtk2.cpp
Log:
- added some features ;)


Modified: toys/vtk2-pld/trunk/vtk2.cpp
==============================================================================
--- toys/vtk2-pld/trunk/vtk2.cpp	(original)
+++ toys/vtk2-pld/trunk/vtk2.cpp	Sat Aug  5 17:45:33 2006
@@ -1,8 +1,9 @@
-/* VTK - Virtual Tomasz Kłoczki v. 0.2 (20060729)
+/* VTK - Virtual Tomasz Kłoczki v. 0.3 (20060803)
  * Author: Bartosz Świątek (shadzik at pld-linux.org)
  * License: Do what you want with it as long as you are an PLD-devel.
  *
  * ChangeLog
+ * v. 0.3 - added zmien(); function
  * v. 0.2 - added functionality, works now
  * v. 0.1 - init version
 */
@@ -13,7 +14,7 @@
 #include <map>
 #include <fstream>
 
-#define book "~/.vtkdatabase"
+#define book ".vtkdatabase"
 
 using namespace std;
 
@@ -22,7 +23,7 @@
 */
 void help()
 {
-        cout << "Usage:\tvtk <options>\n"
+        cout << "Usage:\tvtk2 <options>\n"
                 "-a word tk_word - add word and it's TK version to database\n"
                 "-r word         - remove word from database\n"
                 "-s string       - convert to pl_TK\n"
@@ -49,6 +50,48 @@
    }
 }
 
+/* 
+ * stolen from my C code
+ * change place of letters in a word, beginning with a random letter
+*/
+
+int los(void);
+
+string zmien(string ch)
+{
+  char temp;
+  int i=0;
+  for(i=0;i<ch.size();i++)
+  {
+    if(i!=0)
+    {
+      if((i%los()==0) && (isalpha(ch[i])) && (isalpha(ch[i+1])))
+      {
+        temp=ch[i];
+        ch[i]=ch[i+1];
+        ch[i+1]=temp;
+      }
+    }
+    //cout << ch[i];
+  }
+  //cout << endl;
+  return ch;
+}
+
+int los(void)
+{
+  srand(time(0));
+  int i;
+  i = rand()%10;
+/* This should help get smaller random numbers
+ * but acctually it just sucks
+ * if(i>6)
+ *   i = i/2;
+*/
+  return i;
+}
+
+
 /*
  * Searches for an entry
 */
@@ -80,7 +123,7 @@
       {
          return dane[i+1]["nick"];
       } else if ((dane[i]["nick"] != s_nick) && (i+1 >= dane.size())) {
-         return s_nick;
+         return zmien(s_nick);
       }
    }
 }


More information about the pld-cvs-commit mailing list