|
For class, we've been assigned to make an 8x8 board for various pieces to move around on. I've run into a problem with user input, specifically dealing with how to handle tokens. I'm using Scanner to break up the input, but the problem is the largest command will have 5 tokens and the shortest will only have one. The way it's set up now is that it needs a command that will use all 5 tokens or else it crashes.code:
I'm still fairly new to java, any help would be appreciated. And just an example of what the user input would look like: "create 4 3 fast flexible" with fast and flexible being different types of pieces. It works fine with a command like that, but crashes with a command like "print"
|
# ¿ Feb 20, 2009 05:28 |
|
|
# ¿ May 19, 2024 18:53 |