Weekly may be a little too often. People would get burned out on it after a while. I would say every two weeks so people have a little break between programs. I wouldn't mind if the next challenge was bumped up though.
I was just going to suggest that we have weekly programming challenges. It would definately help newbie programmers to learn differant langauges.
jcrowe
Weekly may be a little too often. People would get burned out on it after a while. I would say every two weeks so people have a little break between programs. I wouldn't mind if the next challenge was bumped up though.
Any ideas on what the challenge could be?
jcrowe
If I could get java working on my linux partition, I'd definately do this in java. I don't know much java, and these kinds of things are perfect to learn. Of course, since I don't have internet on my box, it's taking a while to get java fixed.
The things kenshi was doing with assembler sound cool. Maybe if I get some time on my workterm in the summer I'll pick up some assembler.
Not (at all) optimal, but works.
File: factors.java
For the HDL solution you'll need to wait till I've WAY more free time.Code:import java.io.*; public class factors { public factors() { } public static void main(String args[]) { long to_factorize, number_of_factors = 0, sq_root; if (args.length!=1) { System.out.println("Give me ONE number, please. Thanks. "); System.exit(0); } try { to_factorize = Long.parseLong(args[0]); if (to_factorize <= 0) { System.out.println("I'm veeery patient. "); System.exit(0); } sq_root = Math.round(Math.sqrt((double)to_factorize))+1; for (long i=1; i<sq_root; i++) { if (to_factorize%i==0) { System.out.println(i + " " + to_factorize/i); number_of_factors++; } } System.out.println("Number of factors: " + number_of_factors); } catch (NumberFormatException E) { System.out.println("Give me one VALID number, please. "); System.exit(0); } } }
No offense but I hate computer programs that are polite. I can't stand it when my computer says please and thank you. Well thank you isn't so bad but please is. I can just picture Dos saying, "Please don't format your drive unless you really want to lose all your data." It didn't really say that but follow with me here. If I had programmed it, it would say, "Don't type Y here unless you know what you're about to mess up." And these signs in restaurants that say, "Thank you for not smoking," how do they know you didn't smoke anyway? If I had a restaurant, the signs would say, "No smoking in here maggot." As you can tell, I'm not much of a people person. But I'm tired of all this extra politeness. When it comes to computer programs, it needs to tell a user what to do and if the user doesn't do it, then the user can deal with it when things screw up. The computer shouldn't have to beg the user to insert the next disc. I guess I'm gonna wrap it up with that.Code:import java.io.*; public class factors { public factors() { } public static void main(String args[]) { long to_factorize, number_of_factors = 0, sq_root; if (args.length!=1) { System.out.println("Give me ONE number, please. Thanks. "); System.exit(0); } try { to_factorize = Long.parseLong(args[0]); if (to_factorize <= 0) { System.out.println("I'm veeery patient. "); System.exit(0); } sq_root = Math.round(Math.sqrt((double)to_factorize))+1; for (long i=1; i<sq_root; i++) { if (to_factorize%i==0) { System.out.println(i + " " + to_factorize/i); number_of_factors++; } } System.out.println("Number of factors: " + number_of_factors); } catch (NumberFormatException E) { System.out.println("Give me one VALID number, please. "); System.exit(0); } } }
And the award for being fussy about computer programs goes to :
<a big pause as the audience holds thier breath>
Kenshi!!
;DCode:#!/usr/bin/env ruby print "What is your name? " name = gets.chomp if name.lowcase == "kenshi" then puts "You stinkin' piece of junk! Yo got an ugly name! J00 4r3 n07 t3h l33t!!!" else puts "Hi #{name}" end
Hey. Don't diss on the name Kenshi. That's a cool name. Or is this your way of saying you prefered prince_kenshi?
Bookmarks