transparent wrote:
veggieman001 wrote:
Code:
final static int NORTH = 1; final static int EAST = 2; final static int SOUTH = 4; final static int WEST = 8; int result; float x,y,mx,my; PImage imgTitle = loadImage("http://www.majhost.com/gallery/veggieman/requests/title.png"); PImage imgChar = loadImage("http://www.majhost.com/gallery/veggieman/requests/veggie.png"); PImage imgChar2 = loadImage("http://www.majhost.com/gallery/veggieman/requests/veggie2.png"); PImage imgMuffin = loadImage("http://www.majhost.com/gallery/veggieman/requests/muffin.png"); int nScreen = 0; int nDirection = 0; boolean bMuffin = false; int nScore = 0; int nTime = 60; int nTimeCount; PFont fntScore; void setup() { size(640,480); frameRate(30); result = 0; x = width/2; y = height/2; mx = width/2+50; my = height/2+50; background(imgTitle); //fntScore = loadFont("Arial"); } void draw() { if (nScreen==1){ if (nTime==0) { nScreen=2; } background(255,156,231); switch(result) { case NORTH: y-=ceil(nTime/6); break; case EAST: x+=ceil(nTime/6); nDirection=0; break; case SOUTH: y+=ceil(nTime/6); break; case WEST: x-=ceil(nTime/6); nDirection=1; break; case NORTH|EAST: y-=ceil(nTime/6); x+=ceil(nTime/6); nDirection=0; break; case NORTH|WEST: y-=ceil(nTime/6); x-=ceil(nTime/6); nDirection=1; break; case SOUTH|EAST: y+=ceil(nTime/6); x+=ceil(nTime/6); nDirection=0; break; case SOUTH|WEST: y+=ceil(nTime/6); x-=ceil(nTime/6); nDirection=1; break; } if (x<=49) x=49; if (x>=width-49) x=width-49; if (y<=59) y=59; if (y>=height-59) y=height-59; imageMode(CENTER); if (!bMuffin){ mx = round(random(20,620)); my = round(random(20,460)); bMuffin=true; } image(imgMuffin,mx,my); if (nDirection==0) image(imgChar,x,y); if (nDirection==1) image(imgChar2,x,y); if (dist(x,y,mx,my)<=50){ nScore+=(round(nTime/6)+5); bMuffin=false; } if (nTimeCount != second()){ nTime--; nTimeCount = second(); } // textFont(fntScore,18); // text("Score: " + nScore, 5, 20); text("Time: " + nTime, 5, 20); } if (nScreen==2){ background(255,255,0); textFont(fntScore,22); fill(0); text("Score: " + nScore, width/2-75, height/2); } } void keyPressed(){ switch(key) { case('w'):case('W'):result |=NORTH;break; case('d'):case('D'):result |=EAST;break; case('s'):case('S'):result |=SOUTH;break; case('a'):case('A'):result |=WEST;break; case(' '): nScreen=1;nTimeCount=second();break; } } void keyReleased(){ switch(key) { case('w'):case('W'):result ^=NORTH;break; case('d'):case('D'):result ^=EAST;break; case('s'):case('S'):result ^=SOUTH;break; case('a'):case('A'):result ^=WEST;break; } } void mousePressed(){ if((mouseX>width/2-50)&&(mouseX<width/2+50)){ if((mouseY>height/2+20)&&(mouseY<height/2+70)){ nScreen=0; } } }Javascript? Yeah.
Javascript? No...
Though it can be implemented in
Offline
veggieman001 wrote:
transparent wrote:
veggieman001 wrote:
Code:
final static int NORTH = 1; final static int EAST = 2; final static int SOUTH = 4; final static int WEST = 8; int result; float x,y,mx,my; PImage imgTitle = loadImage("http://www.majhost.com/gallery/veggieman/requests/title.png"); PImage imgChar = loadImage("http://www.majhost.com/gallery/veggieman/requests/veggie.png"); PImage imgChar2 = loadImage("http://www.majhost.com/gallery/veggieman/requests/veggie2.png"); PImage imgMuffin = loadImage("http://www.majhost.com/gallery/veggieman/requests/muffin.png"); int nScreen = 0; int nDirection = 0; boolean bMuffin = false; int nScore = 0; int nTime = 60; int nTimeCount; PFont fntScore; void setup() { size(640,480); frameRate(30); result = 0; x = width/2; y = height/2; mx = width/2+50; my = height/2+50; background(imgTitle); //fntScore = loadFont("Arial"); } void draw() { if (nScreen==1){ if (nTime==0) { nScreen=2; } background(255,156,231); switch(result) { case NORTH: y-=ceil(nTime/6); break; case EAST: x+=ceil(nTime/6); nDirection=0; break; case SOUTH: y+=ceil(nTime/6); break; case WEST: x-=ceil(nTime/6); nDirection=1; break; case NORTH|EAST: y-=ceil(nTime/6); x+=ceil(nTime/6); nDirection=0; break; case NORTH|WEST: y-=ceil(nTime/6); x-=ceil(nTime/6); nDirection=1; break; case SOUTH|EAST: y+=ceil(nTime/6); x+=ceil(nTime/6); nDirection=0; break; case SOUTH|WEST: y+=ceil(nTime/6); x-=ceil(nTime/6); nDirection=1; break; } if (x<=49) x=49; if (x>=width-49) x=width-49; if (y<=59) y=59; if (y>=height-59) y=height-59; imageMode(CENTER); if (!bMuffin){ mx = round(random(20,620)); my = round(random(20,460)); bMuffin=true; } image(imgMuffin,mx,my); if (nDirection==0) image(imgChar,x,y); if (nDirection==1) image(imgChar2,x,y); if (dist(x,y,mx,my)<=50){ nScore+=(round(nTime/6)+5); bMuffin=false; } if (nTimeCount != second()){ nTime--; nTimeCount = second(); } // textFont(fntScore,18); // text("Score: " + nScore, 5, 20); text("Time: " + nTime, 5, 20); } if (nScreen==2){ background(255,255,0); textFont(fntScore,22); fill(0); text("Score: " + nScore, width/2-75, height/2); } } void keyPressed(){ switch(key) { case('w'):case('W'):result |=NORTH;break; case('d'):case('D'):result |=EAST;break; case('s'):case('S'):result |=SOUTH;break; case('a'):case('A'):result |=WEST;break; case(' '): nScreen=1;nTimeCount=second();break; } } void keyReleased(){ switch(key) { case('w'):case('W'):result ^=NORTH;break; case('d'):case('D'):result ^=EAST;break; case('s'):case('S'):result ^=SOUTH;break; case('a'):case('A'):result ^=WEST;break; } } void mousePressed(){ if((mouseX>width/2-50)&&(mouseX<width/2+50)){ if((mouseY>height/2+20)&&(mouseY<height/2+70)){ nScreen=0; } } }Javascript? Yeah.
Javascript? No...
Though it can be implemented in
Oh goodness. How did I not notice the first part.
Course that's not javascript.
Offline
Random calculator I dug up, really easy to make but whatev.
program Calculator; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes { you can add units after this }; {$R *.res} var x:char; //Confim at end i1:integer; //Input 1 o:char; // Operation i2:integer; // Input 2 procedure CloseProgram; begin writeln; writeln; writeln('Press <Enter> to quit'); readln; end; begin repeat write('First number: '); readln(i1); write('Opperation: '); readln(o); write('Secound number: '); readln(i2); if o = '+' then writeln('The answer is ', i1 + i2) else if o = '-' then writeln('The answer is ', i1 - i2) else if o = '*' then writeln('The answer is ', i1 * i2) else if o = '/' then writeln('The answer is ', i1 / i2); write('Do you want to use this again (Y,N) '); readln(x); until x = 'N'; CloseProgram; end.
Offline
Ahh not really, it's easier than C or C++ but as powerful than them
The lazarus IDE is beautiful, it's so easy to get stuff done
Anyway look at the code like this (the rest was auto added)
var //the variables x:char; //Confim at end i1:integer; //Input 1 o:char; // Operation i2:integer; // Input 2 procedure CloseProgram; //procedure begin writeln; writeln; writeln('Press <Enter> to quit'); readln; end; begin //the program repeat write('First number: '); readln(i1); write('Opperation: '); readln(o); write('Secound number: '); readln(i2); if o = '+' then writeln('The answer is ', i1 + i2) else if o = '-' then writeln('The answer is ', i1 - i2) else if o = '*' then writeln('The answer is ', i1 * i2) else if o = '/' then writeln('The answer is ', i1 / i2); write('Do you want to use this again (Y,N) '); readln(x); until x = 'N'; CloseProgram; end.
Last edited by slinger (2012-02-25 12:21:30)
Offline
String word = "cutmeup"; String[] clist = new String[word.length()*4-4]; String firsthalf; String secondhalf; void setup(){ for (int i = 1; i-1 < word.length()-1; i++){ firsthalf = word.substring(0,i); secondhalf = word.substring(i,word.length()); clist[i-1] = firsthalf+"[b][/b]"+secondhalf; } for (int j = 1; j-1 < word.length()-1; j++){ firsthalf = word.substring(0,j); secondhalf = word.substring(j,word.length()); clist[j+word.length()-2] = firsthalf+"[i][/i]"+secondhalf; } for (int k = 1; k-1 < word.length()-1; k++){ firsthalf = word.substring(0,k); secondhalf = word.substring(k,word.length()); clist[k+word.length()*2-3] = firsthalf+"[u][/u]"+secondhalf; } for (int m = 1; m-1 < word.length()-1; m++){ firsthalf = word.substring(0,m); secondhalf = word.substring(m,word.length()); clist[m+word.length()*3-4] = firsthalf+"[url][/url]"+secondhalf; } println(clist); saveStrings("censorlist.txt",clist); }
here is some processing i wrote just a moment ago
it goes through a word and creates a list of all the things like wh[b][/b]at (censor workarounds) which could be used for making a censor list on fluxbb forums
it does have a few flaws like no blocking of multiples and the impossible color tag
Offline
Cool! So that's Processing, eh? I thought it looked like Java, but there is no main method.
Offline
it's based off of java (and usually compiles to it) but is meant to be more simplistic and easier to do visuals with
and yeah there's no main but there's setup and draw which are called at the beginning and repeatedly respectively
Offline
ssss wrote:
nathanprocks wrote:
rdococ wrote:
Codes? Huh? Did you mean Code? I understand why you said Codes, but there's no plural to Code. "Code" is used no matter how much code there is.
Well, I'm making a chat in Command Prompt (EDIT.exe)! I won't post the code yet, because it's unfinished. But I will post it any time soon.Command Prompt is cmd.exe not EDIT.exe... EDIT.exe is the MS-DOS text editor. Lol.
well edit.exe is actually a batch program
. . . Then shouldn't it be edit.bat?
Offline
I made this when I was still obsessed of making batch scripts with Paddle in it.
@echo off title PADDLE SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a" ) call :ColorText 74 "Out in the wild.... there is something..... " ping localhost > nul echo. call :ColorText 74 "called..... " ping localhost > nul echo. call :ColorText 0e "Paddle" echo. call :ColorText 0e "2" echo. call :ColorText 0e "See" ping localhost > nul echo. echo Programmed by cocolover76. DO NOT EXIT YET. ping localhost > nul start http://i39.tinypic.com/2nav6o7.gif echo Moo. You can exit now. :g goto g goto :eof :ColorText echo off <nul set /p ".=%DEL%" > "%~2" findstr /v /a:%1 /R "^$" "%~2" nul del "%~2" > nul 2>&1 goto :eof
Offline
maxskywalker wrote:
ssss wrote:
nathanprocks wrote:
Command Prompt is cmd.exe not EDIT.exe... EDIT.exe is the MS-DOS text editor. Lol.
well edit.exe is actually a batch program
. . . Then shouldn't it be edit.bat?
It's edit.com.
NOT a website, a program.
Last edited by cocolover76 (2012-02-25 19:20:10)
Offline
Who knows what this does and is from?
void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }
I love using this software it just makes things come to life.
Offline
veggieman001 wrote:
Code:
String word = "cutmeup"; String[] clist = new String[word.length()*4-4]; String firsthalf; String secondhalf; void setup(){ for (int i = 1; i-1 < word.length()-1; i++){ firsthalf = word.substring(0,i); secondhalf = word.substring(i,word.length()); clist[i-1] = firsthalf+"[b][/b]"+secondhalf; } for (int j = 1; j-1 < word.length()-1; j++){ firsthalf = word.substring(0,j); secondhalf = word.substring(j,word.length()); clist[j+word.length()-2] = firsthalf+"[i][/i]"+secondhalf; } for (int k = 1; k-1 < word.length()-1; k++){ firsthalf = word.substring(0,k); secondhalf = word.substring(k,word.length()); clist[k+word.length()*2-3] = firsthalf+"[u][/u]"+secondhalf; } for (int m = 1; m-1 < word.length()-1; m++){ firsthalf = word.substring(0,m); secondhalf = word.substring(m,word.length()); clist[m+word.length()*3-4] = firsthalf+"[url][/url]"+secondhalf; } println(clist); saveStrings("censorlist.txt",clist); }here is some processing i wrote just a moment ago
it goes through a word and creates a list of all the things like wh[b][/b]at (censor workarounds) which could be used for making a censor list on fluxbb forums
it does have a few flaws like no blocking of multiples and the impossible color tag
Very awesome
Offline
slinger wrote:
veggieman001 wrote:
Code:
String word = "cutmeup"; String[] clist = new String[word.length()*4-4]; String firsthalf; String secondhalf; void setup(){ for (int i = 1; i-1 < word.length()-1; i++){ firsthalf = word.substring(0,i); secondhalf = word.substring(i,word.length()); clist[i-1] = firsthalf+"[b][/b]"+secondhalf; } for (int j = 1; j-1 < word.length()-1; j++){ firsthalf = word.substring(0,j); secondhalf = word.substring(j,word.length()); clist[j+word.length()-2] = firsthalf+"[i][/i]"+secondhalf; } for (int k = 1; k-1 < word.length()-1; k++){ firsthalf = word.substring(0,k); secondhalf = word.substring(k,word.length()); clist[k+word.length()*2-3] = firsthalf+"[u][/u]"+secondhalf; } for (int m = 1; m-1 < word.length()-1; m++){ firsthalf = word.substring(0,m); secondhalf = word.substring(m,word.length()); clist[m+word.length()*3-4] = firsthalf+"[url][/url]"+secondhalf; } println(clist); saveStrings("censorlist.txt",clist); }here is some processing i wrote just a moment ago
it goes through a word and creates a list of all the things like wh[b][/b]at (censor workarounds) which could be used for making a censor list on fluxbb forums
it does have a few flaws like no blocking of multiples and the impossible color tagVery awesome
thank you sir
Offline
what-the wrote:
Who knows what this does and is from?
Code:
void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }I love using this software it just makes things come to life.
Hmm, java?
And no I have absolutely no idea what that does other than delay 1000 ticks and write something
Is it from a digital clock? :p
Offline
Really old AI chat bot I just fixed up, it's called "learnbot".
program LearnBot; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes { you can add units after this }; {$R *.res} procedure spacer; // creates a space begin writeln; writeln; end; procedure intro; // feel free to edit :P begin writeln('LearnBot is currently under development by Slinger.'); end; procedure instructions; begin writeln('This is LearnBot a chatbot AI.'); writeln('Type "teach" to teach me something and type "wipe" to clear my memory'); writeln('Press <Enter> to continue'); readln; end; var command: string; wipe: integer; teachLoop: integer; lookUpLoop: integer; phraseMemory: array[1..100] of string; responseMemory: array[1..100] of string; begin intro; spacer; instructions; spacer; teachLoop := 1; repeat write('Command: '); readln(command); if command = 'wipe' then //wipes the memory begin wipe := 1; repeat phraseMemory[wipe] := ''; responseMemory[wipe] := ''; wipe := wipe + 1; until wipe > 100 ; writeln('Memory wiped.'); teachLoop := 1; end; if command = 'teach' then begin write('Teach me what? '); readln(phraseMemory[teachLoop]); write('How should I respond? '); readln(responseMemory[teachLoop]); writeln; teachLoop := teachLoop + 1; end else begin lookUpLoop := 0; repeat lookUpLoop := lookUpLoop + 1; until (command = phraseMemory[lookUpLoop]) or (lookUpLoop > 101); writeln(responseMemory[lookUpLoop]); end; until command = 'done'; end.
If you want the program it's on sourceforge (the fixed up one) right here.
Last edited by slinger (2012-02-26 08:03:45)
Offline
import java.util.Random; import java.util.Scanner; import java.io.*; public class philosoraptor { static boolean running = true; public static void main(String args[]){ init(); Scanner scan = new Scanner(System.in); String command; while(running){ command = scan.nextLine(); if (command.equals("quote")){ getquote(); } if (command.equals("close")){ running = false; } } } static int lines = 0; public static void init(){ FileInputStream fileCheck = null; try { fileCheck = new FileInputStream("philosoraptor.txt"); } catch (FileNotFoundException e) { System.out.println("Error finding file"); } boolean getlines = true; while(getlines){ try{ String line = new DataInputStream(fileCheck).readLine(); lines++; if (line == null){ getlines = false; } } catch(IOException x){ getlines = false; } } lines--; System.out.println("Loaded philosoraptor.txt with " + lines + " lines of text!"); } static String quote; public static void getquote() { Random rand = new Random(); int count = 0; int place = rand.nextInt(lines); FileInputStream fileIn; try{ fileIn = new FileInputStream ("philosoraptor.txt"); while(count <= place){ quote = new DataInputStream(fileIn).readLine(); count++; } fileIn.close(); } catch(IOException e){ System.out.println("Philosoraptor is confuzzled."); } System.out.println(quote); } }
This is the code for my Philosoraptor program Here is the txt file, the .java file, and the .class file. If you just want to see it work, download the .class file into the same folder as the txt. Then just run it from command line, or with a batch script
java philosoraptor
Offline
slinger wrote:
what-the wrote:
Who knows what this does and is from?
Code:
void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }I love using this software it just makes things come to life.
Hmm, java?
And no I have absolutely no idea what that does other than delay 1000 ticks and write something
Is it from a digital clock? :p
Yes it is Java. It's used to program a micro-controller, in this case an ATmega on an Arduino board. That will make pin 13 which has an LED connected to it, flash on and off.
So when I said "it just make things come to life" I meant it literately.
Offline
Cool
16Skittles wrote:
Code:
import java.util.Random; import java.util.Scanner; import java.io.*; public class philosoraptor { static boolean running = true; public static void main(String args[]){ init(); Scanner scan = new Scanner(System.in); String command; while(running){ command = scan.nextLine(); if (command.equals("quote")){ getquote(); } if (command.equals("close")){ running = false; } } } static int lines = 0; public static void init(){ FileInputStream fileCheck = null; try { fileCheck = new FileInputStream("philosoraptor.txt"); } catch (FileNotFoundException e) { System.out.println("Error finding file"); } boolean getlines = true; while(getlines){ try{ String line = new DataInputStream(fileCheck).readLine(); lines++; if (line == null){ getlines = false; } } catch(IOException x){ getlines = false; } } lines--; System.out.println("Loaded philosoraptor.txt with " + lines + " lines of text!"); } static String quote; public static void getquote() { Random rand = new Random(); int count = 0; int place = rand.nextInt(lines); FileInputStream fileIn; try{ fileIn = new FileInputStream ("philosoraptor.txt"); while(count <= place){ quote = new DataInputStream(fileIn).readLine(); count++; } fileIn.close(); } catch(IOException e){ System.out.println("Philosoraptor is confuzzled."); } System.out.println(quote); } }This is the code for my Philosoraptor program Here is the txt file, the .java file, and the .class file. If you just want to see it work, download the .class file into the same folder as the txt. Then just run it from command line, or with a batch script
Code:
java philosoraptor
.jar available? :p
Offline
slinger wrote:
Cool
16Skittles wrote:
Code:
import java.util.Random; import java.util.Scanner; import java.io.*; public class philosoraptor { static boolean running = true; public static void main(String args[]){ init(); Scanner scan = new Scanner(System.in); String command; while(running){ command = scan.nextLine(); if (command.equals("quote")){ getquote(); } if (command.equals("close")){ running = false; } } } static int lines = 0; public static void init(){ FileInputStream fileCheck = null; try { fileCheck = new FileInputStream("philosoraptor.txt"); } catch (FileNotFoundException e) { System.out.println("Error finding file"); } boolean getlines = true; while(getlines){ try{ String line = new DataInputStream(fileCheck).readLine(); lines++; if (line == null){ getlines = false; } } catch(IOException x){ getlines = false; } } lines--; System.out.println("Loaded philosoraptor.txt with " + lines + " lines of text!"); } static String quote; public static void getquote() { Random rand = new Random(); int count = 0; int place = rand.nextInt(lines); FileInputStream fileIn; try{ fileIn = new FileInputStream ("philosoraptor.txt"); while(count <= place){ quote = new DataInputStream(fileIn).readLine(); count++; } fileIn.close(); } catch(IOException e){ System.out.println("Philosoraptor is confuzzled."); } System.out.println(quote); } }This is the code for my Philosoraptor program Here is the txt file, the .java file, and the .class file. If you just want to see it work, download the .class file into the same folder as the txt. Then just run it from command line, or with a batch script
Code:
java philosoraptor.jar available? :p
You can run the .class file, but I'm looking into how to make it a jar.
Also, you SHOULD be able to add an unlimited amount of quotes to philosoraptor.txt and it will automatically detect them, although it is horribly inefficient and will take longer to load and longer to read the more quotes there are.
Edit: I can't seem to get the command line window to appear when I use the .jar. Also, it just seems like a waste since there is only one class.
Last edited by 16Skittles (2012-02-26 08:43:10)
Offline