• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

seemingly identical code producing 2 different outcomes.

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this mock RPG i made, I allow the option of attack or magic. in the fighter class...the magic stat is less than the strength stat and yet the magic attacks do significantly more than attack attacks when you actually run the program and I am mystified. Here is the snippet of code. (I wanted to attach the program but you cannot attach zip files. Is there a way to make some kind of special file with eclipse that another eclipse editor can open the entire project?)


and here is the stats page:



 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll have a better chance of getting help if you can provide an SSCCE that has just enough code to demonstrate your problem and nothing else, and show clearly and precisely what behavior your expected and what you saw instead.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

brent carter wrote:Is there a way to make some kind of special file with eclipse that another eclipse editor can open the entire project?)



There's no need for that. Folks won't be inclined to deal with an entire project anyway. You need to narrow down the source of the problem enough that a small snippet of code (ideally an SSCCE) is sufficient to demonstrate it.
 
Ranch Hand
Posts: 137
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at line 50, compare it to line 49.

Repetition is a big source of bugs. Can you think of a way to avoid repeating 'oldlady' and 'hippie' all over the place?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's the dreaded Copy-Paste-Forget-To-Change antipattern!
 
brent carter
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys what I have recently been learning to do is make a generic class and extending other classes of different enemies from the first class, making it so i only have to write everything one time and it makes the code look much nicer as well. Now if i could only stop playing the new star wars game I may actually get some work done!
 
reply
    Bookmark Topic Watch Topic
  • New Topic