|
I'm in need of a little java help for school. We're currently working on Programming Othello/Reversi whatever the gently caress you choose to call it by using recursion. Now I've gotten mine to work for the most part however the left column and bottom row aren't playable because my recursion decides to check out of bounds and eclipse returns an error. I haven't for the life of me a clue on how to fix it. My other problem is that we're required to have some form of A.I to play against. It doesn't have to be smart but I haven't a clue on how to program any form of A.I and our teacher for the class didn't teach us how to do it either. So I'm coming to the goons for help. Anyways, Here's my recursion for checking to the left it works for every column besides the last one. Obuttons being the name for my game board array, everything else should be somewhat self explanatory? code:
code:
code:
|
# ¿ Nov 11, 2010 01:23 |
|
|
# ¿ May 20, 2024 06:32 |
|
_aaron posted:I'm not sure what your fleft method does, but you pass the value at the actual clicked row and column to that method, but when you do if check for different, you're using the column - 1 (or the row + 1). I'm obviously not familiar with the rest of your code, but my guess is that clicking the far left column gives you a column value of 0; when you subtract 1 from this, you get -1, and that's not a valid array index, hence your exception. Same thing for the bottom row - adding 1 will put you outside the bounds of the array. code:
I think? I hope I'm explaining that right. But I solved my problem. Thanks for your help.
|
# ¿ Nov 12, 2010 03:49 |
|
I was wondering if anyone could help me out here, I'm currently in a high school computer science 2 class and our current project (and final for the year)is as a class we're writing super smash brothers as a class (teacher included). The only real requirements is that every piece of code besides the engine must be written from scratch. Here lies our problem, none of my classmates (There's 7 of us) except for one guy knows jack poo poo about writing a physics engine. That one guy however also has to handle all of the networking code because he is the only one in the class that knows anything about networking as well. Most of us all feel that it's not exactly fair or going to be efficant for him to be writing the two most important parts of the code. My question is does anyone know any opensource 2D physics engines that are relatively good and easy to understand? I've stumbled around trying to look for a decent one and came across Phys2D as well as JBullet. The problem is our teacher doesn't like the idea of using JBullet (or couldn't understand the code) so we're back at square one. So to make this short and simple, does anyone know a decent opensource 2D physics engine that would be acceptable for writing a java version of Super Smash Brothers? keep in mind this doesn't have to be perfect we're a bunch of worthless highschool students.
|
# ¿ Mar 11, 2011 06:40 |
|
Thanks for the help guys, I really appreciate it. We were looking at using an open source engine just for the purpose of saving time since we only have about 7 weeks to write everything else. However three of us just ended up getting together and writing our own. So far we have friction, gravity and jumping and all of our characters are going to inherit or be based off a basic rectangle (am I saying that right?) On a completely unrelated note from this project, 7 years ago or so my computer science teacher had the class at the time write their own version of Legend of Zelda. The class never got very far other than creating a basic dungeon you could walk through that had a short midi sound file playing in the background. You could "attack" but you wouldn't do any damage and there was only one little enemy that didn't attack you but he also couldn't be killed. The weird issue is and it's an issue we believe with how the sound threading was coded? (I'm trying to explain things that are over my head again) however when the midi file for the dungeon sound ends the program closes and no one can figure out why the hell this happens. anyone have any ideas on what the problem could be? like I said it was coded by the kids who took his class 7 years ago so other than having the code I really don't know anything about how it was written. again, thanks for the help guys.
|
# ¿ Mar 11, 2011 22:32 |
|
I was wondering if anyone could recommended me some good Java books to sharpen my skills with. I find myself having to refer back to old code that I've written previously to remember how to do the easiest of things and it's really getting old, especially since I plan on majoring in computer science when I go off to college. The only book I have right now (and I can't even find it) is the standard computer science book written by Leon Schram that was given to me when I started Computer Science 1 two years ago.
|
# ¿ Mar 17, 2011 08:34 |
|
MariusMcG posted:Well, it depends on what you're looking to do with Java. I personally love Effective Java, but that's more of a general book. You might prefer to read about a specific Java technology in a recipe-style book, like Spring Recipes. Thanks, I'm definitely looking for a more general Java book right now to refresh the skills that I already know. The most complicated thing I've ever put my head into was advanced swing menus. The most complicated thing I've ever written was a simple version of battleship and even that didn't work correctly so I'm definitely still looking for more basic (or what I consider to be basic?) books. Internet Janitor posted:Java Puzzlers is also a great way to learn more about the language, attacking the issue from a different angle. The book's site has some pretty intriguing samples to try out if you think you might be interested. This book might not teach you everything you want to know, but it will expose gaps in your understanding and push you to seek out more information. Sound Sound 2 Loop Sound
|
# ¿ Mar 19, 2011 17:01 |
|
|
# ¿ May 20, 2024 06:32 |
|
Sound...How the gently caress do I make sound work? Sigh, I wish that's all I had to post. To elaborate I'm a fairly beginner (or what I believe to be beginner) programmer so bare with me. I'm currently working on a Super Smash Brothers project in CS 2 class (High school) and It's my job to get sound working. Problem is, I know nothing about threading or Java's sound API's. Can anyone recommend me a good book i can go buy or a tutorial I can follow on getting sound to play? I know it's not really a simple process but I'm trying to start simple. All I'm looking to do right now is get a simple 1 minute song to play on our splash screen and loop and continue looping until the user presses enter and moves to the mode selection screen. The clip I'm trying to use is an mp3 that I pulled from youtube, I'm not sure if java can use mp3's? if not what file format do they need to be in? midi, wav's? Feel free to call me retarded if I'm not making any sense at all. Thanks.
|
# ¿ Apr 7, 2011 18:03 |