Jump to content
  • Advertisement

Lucky Ace Card

Member
  • Content Count

    126
  • Joined

  • Last visited

Everything posted by Lucky Ace Card

  1. *EDIT* Sorry, I fixed it. But I can't delete the topic. It was a NullPointer. [Edited by - Lucky Ace Card on December 28, 2006 9:22:15 PM]
  2. Lucky Ace Card

    Question on C#/C++

    I'm currently learning Java for AP Computer Science class. However, I also want to learn another language at the same time. I began on C#. Pretty simple to start with. However, I want to learn a language that would be more geared towards games. For example, 2D side scrolling platformers/shooters. Y'know. Is C# really a wise choice for things like those? Or should I check out C++ instead? I'm leaning towards C++, but I wanted to hear some opinions on this. Any help is appreciated.
  3. I'm a senior in High School taking AP Computer Science, which covers Java. I've already read the whole school text book, skimmed over some others, and I plan to keep learning Java throughout the school year. However, I'm also interested in other languages, specifically C++/C#. They seem to be more game oriented than Java, and I'd really like to know multiple programming languages. Now, is it a good idea to study both Java and C++/C# at the same time? I'm not sure if that would be too hard or confusing or what. Any opinions on that? Thanks for any help.
  4. I didn't really find any good online material comparing C++ and C#, but I did manage to contact my friend's dad who has a good position at Microsoft. And he gave me some information on it. If anyone else wants to help a little and give their insight on the difference between C++ and C#, it's be appreciated. =)
  5. Is there any popular opinion on which language is stronger for game development? Or is that a very debateable issue?
  6. I didn't know C++ and C# were so different. Odd. I'll have to research more as to which I want to study right now. I'm pretty confident I could handle learning multiple languages, especially if they are relatively similar. I'll give it a shot. But yeah, knowing multiple languages really would help anyone become more marketable. I'll probably find some books on C++ or C#, whichever it is I'm gunna study now. Can anyone help me out on whether I should look at C++ or C#? I guess I'm not too sure of how C# is different.
  7. I made a simple "maze" program. It only has 1 map, which is a U shaped map. I originally had the viewMap method print a different map for each case, but I recently replaced it with a default map that gets written over with "You". I also had tons of else if's that I made into case. But how else can I improve the code? Any suggestions would be appreciated, since I'm pretty new to Java, and I don't feel like I can write clean code. import java.util.Scanner; public class Maze4 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int currentRoom = 3; String choice = ""; System.out.println("This program is a test version of a maze."); System.out.println("==============================================================="); System.out.println("Welcome to the maze game. Type the direction you wish to travel or type 'map' to see the map."); System.out.println("Type 'quit' to quit."); System.out.println(); System.out.println("================================================================"); System.out.println("================================================================\n\n"); System.out.println(); while (choice.equalsIgnoreCase("quit") != true) { choice = ""; String desc = getRoomDesc(currentRoom); System.out.println(desc); System.out.print("\nEnter a choice: "); choice = scan.nextLine(); while (choice.equalsIgnoreCase("")) { System.out.print("Enter a choice: "); choice = scan.nextLine(); } choice = choice.toLowerCase(); if (choice.equalsIgnoreCase("left")) currentRoom = moveLeft(currentRoom); else if (choice.equalsIgnoreCase("right")) currentRoom = moveRight(currentRoom); else if (choice.equalsIgnoreCase("down")) currentRoom = moveDown(currentRoom); else if (choice.equalsIgnoreCase("up")) currentRoom = moveUp(currentRoom); else if (choice.equalsIgnoreCase("map")) viewMap(currentRoom); else if (choice.equalsIgnoreCase("quit") != true) System.out.println("Sorry, that's not a valid choice."); } } public static boolean checkUp(int currentRoom) { boolean check; if (currentRoom == 0 || currentRoom == 1 || currentRoom == 2 || currentRoom == 3) check = false; else if (currentRoom == 9 || currentRoom == 10 || currentRoom == 11) check = false; else check = true; return check; } public static boolean checkLeft(int currentRoom) { boolean check; if (currentRoom == 0 || currentRoom == 4 || currentRoom == 8) check = false; else check = true; return check; } public static boolean checkDown(int currentRoom) { boolean check; if (currentRoom == 1 || currentRoom == 2 || currentRoom == 3) check = false; else if (currentRoom == 8 || currentRoom == 9 || currentRoom == 10 || currentRoom == 11) check = false; else check = true; return check; } public static boolean checkRight(int currentRoom) { boolean check; if (currentRoom == 3 || currentRoom == 4 || currentRoom == 11) check = false; else check = true; return check; } public static String getRoomDesc(int currentRoom) { viewMap(currentRoom); String desc; if (currentRoom == 3) { desc = "\nYou are in room 3."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 2) { desc = "\nYou are in room 2."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 1) { desc = "\nYou are in room 1."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 0) { desc = "\nYou are in room 0."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 4) { desc = "\nYou are in room 4."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 8) { desc = "\nYou are in room 8."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 9) { desc = "\nYou are in room 9."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 10) { desc = "\nYou are in room 10."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else if (currentRoom == 11) { desc = "\nYou are in room 11."; if (checkLeft(currentRoom)) desc += "\nYou may move left."; if (checkRight(currentRoom)) desc += "\nYou may move right."; if (checkDown(currentRoom)) desc += "\nYou may move down."; if (checkUp(currentRoom)) desc += "\nYou may move up."; } else desc = "\nInvalid room number."; return desc; } public static int moveLeft(int currentRoom) { if (checkLeft(currentRoom) == true) currentRoom -= 1; else System.out.println("You can not move that way. Try another direction."); return currentRoom; } public static int moveRight(int currentRoom) { if (checkRight(currentRoom) == true) currentRoom += 1; else System.out.println("You can not move that way. Try another direction."); return currentRoom; } public static int moveDown(int currentRoom) { if (checkDown(currentRoom) == true) currentRoom += 4; else System.out.println("You can not move that way. Try another direction."); return currentRoom; } public static int moveUp(int currentRoom) { if (checkUp(currentRoom) == true) currentRoom -= 4; else System.out.println("You can not move that way. Try another direction."); return currentRoom; } public static void viewMap(int currentRoom) { String plain = "____________________________\n" + "| | | | |\n" + "| 0 | 1 | 2 | 3 |\n" + "| | | | |\n" + "|______|______|______|_____|\n" + "| |X X X |X X X |X X X|\n" + "| 4 |X 5 X |X 6 X |X 7 X|\n" + "| |X X X |X X X |X X X|\n" + "|______|______|______|_____|\n" + "| | | | |\n" + "| 8 | 9 | 10 | 11 |\n" + "| | | | |\n" + "|______|______|______|_____| "; char arrayMap[] = plain.toCharArray(); switch (currentRoom) { case 3: { arrayMap[110] = 'Y'; arrayMap[111] = 'o'; arrayMap[112] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 2: { arrayMap[103] = 'Y'; arrayMap[104] = 'o'; arrayMap[105] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 1: { arrayMap[97] = 'Y'; arrayMap[98] = 'o'; arrayMap[99] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 0: { arrayMap[90] = 'Y'; arrayMap[91] = 'o'; arrayMap[92] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 4: { arrayMap[205] = 'Y'; arrayMap[206] = 'o'; arrayMap[207] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 8: { arrayMap[321] = 'Y'; arrayMap[322] = 'o'; arrayMap[323] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 9: { arrayMap[329] = 'Y'; arrayMap[330] = 'o'; arrayMap[331] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 10: { arrayMap[336] = 'Y'; arrayMap[337] = 'o'; arrayMap[338] = 'u'; System.out.println(); System.out.println(arrayMap); break; } case 11: { arrayMap[343] = 'Y'; arrayMap[344] = 'o'; arrayMap[345] = 'u'; System.out.println(); System.out.println(arrayMap); break; } default: System.out.println("Invalid map."); break; } } }
  8. Lucky Ace Card

    How can I improve this java code?

    So I think I've written a decent check method and implemented it into the main method. I deleted all the useless methods like checkLeft and moveLeft, etc. import java.util.Scanner; public class Maze12 { public static final int RIGHT = 0; public static final int UP = 1; public static final int LEFT = 2; public static final int DOWN = 3; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int currentRoom = 3; String choice = ""; int index1 = 110; System.out.println("This program is a test version of a maze."); System.out.println("==============================================================="); System.out.println("Welcome to the maze game. Type the direction you wish to travel or type 'map' to see the map."); System.out.println("Type 'quit' to quit."); System.out.println(); System.out.println("================================================================"); System.out.println("================================================================\n\n"); System.out.println(); while (choice.equalsIgnoreCase("quit") != true) //Until user types quit { choice = ""; int[] details = {}; String desc = getRoomDesc(currentRoom, index1); //Get room info. System.out.println(desc); System.out.print("\nEnter a choice: "); choice = scan.nextLine(); //Get user's choice while (choice.equalsIgnoreCase("")) { System.out.print("Enter a choice: "); choice = scan.nextLine(); //Continue prompt while invalid input } choice = choice.toLowerCase(); if (choice.equalsIgnoreCase("left")) //If left { details = move(LEFT, currentRoom, index1); //Move you left currentRoom = details[0]; //Creates new currentRoom value that user has moved to index1 = details[1]; //Creates a new place to draw 'You' } else if (choice.equalsIgnoreCase("right")) { details = move(RIGHT, currentRoom, index1); //Move you left currentRoom = details[0]; //Creates new currentRoom value that user has moved to index1 = details[1]; //Creates a new place to draw 'You' } else if (choice.equalsIgnoreCase("down")) { details = move(DOWN, currentRoom, index1); //Move you left currentRoom = details[0]; //Creates new currentRoom value that user has moved to index1 = details[1]; //Creates a new place to draw 'You' } else if (choice.equalsIgnoreCase("up")) { details = move(UP, currentRoom, index1); //Move you left currentRoom = details[0]; //Creates new currentRoom value that user has moved to index1 = details[1]; //Creates a new place to draw 'You' } else if (choice.equalsIgnoreCase("map")) viewMap(currentRoom, index1); //Prints map else if (choice.equalsIgnoreCase("quit") != true) System.out.println("Sorry, that's not a valid choice."); } } public static String getRoomDesc(int currentRoom, int index1) { viewMap(currentRoom, index1); String desc = "You are in room " + currentRoom + ".\nYou may move:\n"; if (check(RIGHT, currentRoom)) desc+="Right\n"; if (check(LEFT, currentRoom)) desc+="Left\n"; if (check(DOWN, currentRoom)) desc+="Down\n"; if (check(UP, currentRoom)) desc+="Up\n"; return desc; } public static void viewMap(int currentRoom, int index1) { String plain = "____________________________\n" + "| | | | |\n" + "| 0 | 1 | 2 | 3 |\n" + "| | | | |\n" + "|______|______|______|_____|\n" + "| |X X X |X X X |X X X|\n" + "| 4 |X 5 X |X 6 X |X 7 X|\n" + "| |X X X |X X X |X X X|\n" + "|______|______|______|_____|\n" + "| | | | |\n" + "| 8 | 9 | 10 | 11 |\n" + "| | | | |\n" + "|______|______|______|_____| "; char arrayMap[] = plain.toCharArray(); arrayMap[index1] = 'Y'; arrayMap[index1+1] = 'o'; arrayMap[index1+2] = 'u'; System.out.println(); System.out.println(arrayMap); } public static int[] move(int direction, int currentRoom, int index1) { boolean canMove; int currentRoomChange; int index1Change; final int[] currentRoomChanges = {1, -4, -1, 4}; final int[] index1Changes = {7, -116, -7, 116}; if (check(direction, currentRoom)) { currentRoom += currentRoomChanges[direction]; index1 += index1Changes[direction]; } else { System.out.println("You can not move that way. Try another direction."); } int list[] = {currentRoom, index1}; return list; } public static boolean check(int direction, int currentRoom) { //0=right //2=left //1=up //3=down boolean goodMove; boolean[] RIGHT = {true, true, true, false, false, false, false, false, true, true, true, false}; boolean[] LEFT = {false, true, true, true, false, false, false, false, false, true, true, true}; boolean[] UP = {false, false, false, false, true, false, false, false, true, false, false, false}; boolean[] DOWN = {true, false, false, false, true, false, false, false, false, false, false, false}; switch (direction) { case 0: goodMove = RIGHT[currentRoom]; break; case 1: goodMove = UP[currentRoom]; break; case 2: goodMove = LEFT[currentRoom]; break; case 3: goodMove = DOWN[currentRoom]; break; default: goodMove = false; break; } return goodMove; } } Any more suggestions? Because this topic has taught me a lot about writing clean code. The main method looks a little clunky, don't ya think..?
  9. Lucky Ace Card

    How can I improve this java code?

    Zahlman, are you like.... a Computer Science professor or something? You're amazing. And what you did actually makes perfect sense to me now that you've explained it. As soon as I finish all this work for other classes, I'm gunna give the check() method a shot. Thanks a lot for the help! I'll check back here a little later with how it's coming along.
  10. Lucky Ace Card

    How can I improve this java code?

    Alright, here's a newer version of what I have now. I mainly changed the way the word "you" is drawn, as I made it dynamic. import java.util.Scanner; public class Maze8 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int currentRoom = 3; String choice = ""; int index1 = 110; System.out.println("This program is a test version of a maze."); System.out.println("==============================================================="); System.out.println("Welcome to the maze game. Type the direction you wish to travel or type 'map' to see the map."); System.out.println("Type 'quit' to quit."); System.out.println(); System.out.println("================================================================"); System.out.println("================================================================\n\n"); System.out.println(); while (choice.equalsIgnoreCase("quit") != true) //Until user types quit { choice = ""; int[] details = {}; String desc = getRoomDesc(currentRoom, index1); //Get room info. System.out.println(desc); System.out.print("\nEnter a choice: "); choice = scan.nextLine(); //Get user's choice while (choice.equalsIgnoreCase("")) { System.out.print("Enter a choice: "); choice = scan.nextLine(); //Continue prompt while invalid input } choice = choice.toLowerCase(); if (choice.equalsIgnoreCase("left")) //If left { details = moveLeft(currentRoom, index1); //Move you left currentRoom = details[0]; //Creates new currentRoom value that user has moved to index1 = details[1]; //Creates a new place to draw 'You' } else if (choice.equalsIgnoreCase("right")) { details = moveRight(currentRoom, index1); currentRoom = details[0]; index1 = details[1]; } else if (choice.equalsIgnoreCase("down")) { details = moveDown(currentRoom, index1); currentRoom = details[0]; index1 = details[1]; } else if (choice.equalsIgnoreCase("up")) { details = moveUp(currentRoom, index1); currentRoom = details[0]; index1 = details[1]; } else if (choice.equalsIgnoreCase("map")) viewMap(currentRoom, index1); //Prints map else if (choice.equalsIgnoreCase("quit") != true) System.out.println("Sorry, that's not a valid choice."); } } public static boolean checkUp(int currentRoom) { boolean check; if (currentRoom == 0 || currentRoom == 1 || currentRoom == 2 || currentRoom == 3) check = false; else if (currentRoom == 9 || currentRoom == 10 || currentRoom == 11) check = false; else check = true; return check; } public static boolean checkLeft(int currentRoom) { boolean check; if (currentRoom == 0 || currentRoom == 4 || currentRoom == 8) check = false; else check = true; return check; } public static boolean checkDown(int currentRoom) { boolean check; if (currentRoom == 1 || currentRoom == 2 || currentRoom == 3) check = false; else if (currentRoom == 8 || currentRoom == 9 || currentRoom == 10 || currentRoom == 11) check = false; else check = true; return check; } public static boolean checkRight(int currentRoom) { boolean check; if (currentRoom == 3 || currentRoom == 4 || currentRoom == 11) check = false; else check = true; return check; } public static String getRoomDesc(int currentRoom, int index1) { viewMap(currentRoom, index1); String desc = "You are in room " + currentRoom + ".\nYou may move:\n"; if (checkRight(currentRoom)) desc+="Right\n"; if (checkLeft(currentRoom)) desc+="Left\n"; if (checkDown(currentRoom)) desc+="Down\n"; if (checkUp(currentRoom)) desc+="Up\n"; return desc; } public static int[] moveLeft(int currentRoom, int index1) { if (checkLeft(currentRoom) == true) { currentRoom -= 1; index1 -= 7; } else System.out.println("You can not move that way. Try another direction."); int[] list = {currentRoom, index1}; return list; } public static int[] moveRight(int currentRoom, int index1) { if (checkRight(currentRoom) == true) { currentRoom += 1; index1 += 7; } else System.out.println("You can not move that way. Try another direction."); int[] list = {currentRoom, index1}; return list; } public static int[] moveDown(int currentRoom, int index1) { if (checkDown(currentRoom) == true) { currentRoom += 4; index1 += 116; } else System.out.println("You can not move that way. Try another direction."); int[] list = {currentRoom, index1}; return list; } public static int[] moveUp(int currentRoom, int index1) { if (checkUp(currentRoom) == true) { currentRoom -= 4; index1 -= 116; } else System.out.println("You can not move that way. Try another direction."); int[] list = {currentRoom, index1}; return list; } public static void viewMap(int currentRoom, int index1) { String plain = "____________________________\n" + "| | | | |\n" + "| 0 | 1 | 2 | 3 |\n" + "| | | | |\n" + "|______|______|______|_____|\n" + "| |X X X |X X X |X X X|\n" + "| 4 |X 5 X |X 6 X |X 7 X|\n" + "| |X X X |X X X |X X X|\n" + "|______|______|______|_____|\n" + "| | | | |\n" + "| 8 | 9 | 10 | 11 |\n" + "| | | | |\n" + "|______|______|______|_____| "; char arrayMap[] = plain.toCharArray(); arrayMap[index1] = 'Y'; arrayMap[index1+1] = 'o'; arrayMap[index1+2] = 'u'; System.out.println(); System.out.println(arrayMap); } } Zahlman, I just read your code, and it's a bit too advanced for me. =P Mine's ugly, and I have trouble understanding some of your concepts. I understand what you do as I read it (for the most part), but I have some work to do before I can fully understand how to make it work like that without simply copying it and pasting it. My AP Computer Science teacher (who's forte isn't really java...) says the next step I should take is to make the walking character into a class so he can be a separate object. I guess that'd be a good idea. He could hold his own attributes like what room he is in, what room he was previously in, and it could even lead to having multiple characters in the same maze. I'm not exactly sure how to go about implementing an object from another class I write (I know the syntax and all that, just never actually used this concept yet). I suppose I'll go try it out.
  11. Lucky Ace Card

    How can I improve this java code?

    Thanks guys. Those are good suggestions. I think I'll try some of them out! =) About classes, I really don't know much of how I would be able to use them in this program efficiently. I've never really done it before.
  12. I wanted to try using GUIs, and I decided to try to create a Guess My Number game using GUIs. However, when the program asks "Do you wish to play again?" and the user clicks "No", the program makes the user play again anyway. I can't figure out why. I've occasionally had the program successfully allow a quit upon clicking "No", but I can't figure out what was different about what I did. Anyway, here is the code. Can anyone help me to see what's causing this problem? import javax.swing.JOptionPane; import java.util.Random; public class GuessMyNumber { public static void main(String[] args) { Random generator = new Random(); String guessStr; int currentGuess = -1; int guessCount = 0; int repeat = JOptionPane.YES_OPTION; int overallRepeat = JOptionPane.YES_OPTION; do { int correctNum = generator.nextInt(100) + 1; repeat = JOptionPane.YES_OPTION; do { JOptionPane.showMessageDialog(null, correctNum); guessCount++; guessStr = JOptionPane.showInputDialog (null, "I am thinking of a number between 1 and 100.\nWhat is your guess?"); currentGuess = Integer.parseInt(guessStr); if (currentGuess > correctNum) repeat = JOptionPane.showConfirmDialog(null, "You guessed too high. Guess again?"); else if (currentGuess < correctNum) repeat = JOptionPane.showConfirmDialog(null, "You guessed too low. Guess again?"); else if (currentGuess == correctNum) repeat = JOptionPane.CANCEL_OPTION; } while (repeat == JOptionPane.YES_OPTION); if (currentGuess == correctNum) { JOptionPane.showMessageDialog(null, "You guessed it! It took you " + guessCount + " tries."); } guessCount = 0; overallRepeat = JOptionPane.showConfirmDialog(null, "Play a new game?"); } while (overallRepeat == JOptionPane.YES_OPTION); JOptionPane.showMessageDialog(null, "Thank you for playing."); } } Thanks for any help.
  13. Lucky Ace Card

    [java] Help: Guess my Number GUI

    Yes, I'm running exactly that version. Perhaps I'll try another environment. I've tried compiling in both JCreator and command prompt's javac, and running them in each. Same effect. I'll try it on the school computers tomorrow I suppose.
  14. I want to show my brother a program I've made in Java. However, the only way I know how to run it is to open it in JCreator and click Run. Now, if I send the class file over to him, how can he run it? His computer doesn't have stuff like javac and JCreator. Sounds like a really stupid question. But could anyone help? Thanks.
  15. Lucky Ace Card

    Ahhhh keyboard failure. Help?

    Okay, thanks for your help Sneftel. I've had this problem for a long time and nobody has known how to fix it. So you're a genius.
  16. Lucky Ace Card

    Ahhhh keyboard failure. Help?

    So my computer came with a USB Keyboard. Everything worked fine. However, over time, it stopped working when I'd restart my computer. I'd have to switch USB ports, but I eventually ran out of working USB ports. The ports worked with everything else, just not the keyboard. I had to switch keyboards, and now this one is having the same problem. So now neither of my USB keyboards work on that computer. It's weird, the F lock light turns on and stuff and the Calculator button works. But not letters or anything else... Anyone know how to fix this? Thanks for any help.
  17. Lucky Ace Card

    [java] Help: Guess my Number GUI

    I've tried to run the debugger in Jcreator many times, and I've still never gotten it.
  18. Lucky Ace Card

    Ahhhh keyboard failure. Help?

    I can probably just do this each time the problem arises, right?
  19. Lucky Ace Card

    Ahhhh keyboard failure. Help?

    I'm not able to delete anything in that registry folder. Even the Registry Help File says I can't delete those. Any suggestions? *EDIT* I clicked the Edit button, but it added on a whole new post. Lame. Sorry about that. Anyway, deleting those sub folders fixed the problem! Thanks a lot for the help!
  20. Lucky Ace Card

    Ahhhh keyboard failure. Help?

    I'm not able to delete anything in that registry folder. Even the Registry Help File says I can't delete those. Any suggestions?
  21. Lucky Ace Card

    Another Digipen topic...

    I know it's been said before, but a representative visited my High School from Digipen today and it really interested me. Now, I've never been too sure if I want to go to Digipen. First of all, I know for sure I want to major in Computer Science/Programming. Also, I really would like to get into the video game industry, but I do not want to 100% limit myself to that. My parents suggest I go to the University of Washington and get my Bachelor's in Computer Science, and then consider Digipen. They want to see me with a more rounded schedule that contains English and History and such. Any opinions on that idea? Also, I was wondering about job applications. When a big company (game company?) is reviewing applications for a programming job, and they see a student that went all the way through Digipen vs. a student who went to a normal university, what would go through their head? If anyone could help me out with these questions, and maybe just give some more necessary information, that'd be great. Thanks for any help.
  22. Lucky Ace Card

    Another Digipen topic...

    Thanks for the help. Can anyone else give me some more insight, perhaps?
  23. I'm working on a program to see if a word is a palindrome or not for AP Computer Science. Now, here's how the program will work generally. import java.util.Scanner; public class Palindrome { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter a potential palindrome: "); String palin = scan.nextLine(); String result = ""; for (int count = palin.length()-1; count >= 0; count--) { //Need help here //I want to append to the result String whichever char //is at palin.charAt(count) } } } So that's what it'll be doing. However, how do I append a char data type to a String object? I want to then just compare the strings to see if they are the same or not. Any help please? Thanks.
  24. Lucky Ace Card

    [java] Adding a char to a String?

    Aha, thanks a bunch. I successfully got it working. Here's how it goes now: import java.util.Scanner; public class Palindrome { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter a potential palindrome: "); String palin = scan.nextLine(); String result = ""; for (int count = palin.length()-1; count >= 0; count--) { char current[] = {palin.charAt(count)}; String toConcat = new String(current); result = result.concat(toConcat); } palin = palin.toLowerCase(); result = result.toLowerCase(); System.out.println("\nYour word is: " + palin); System.out.println("Backwards, this is: " + result); if (palin.equals(result)) { System.out.println(); System.out.println("That word is a palindrome!"); } else { System.out.println(); System.out.println("That word is not a palindrome."); } } } Thanks for the help!
  25. Lucky Ace Card

    [java] cs1.Keyboard?

    Alright, thanks for the help. I'll just tell my teacher I'm more comfortable using Scanner, and it seems like a better method.
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!