Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Need help improving my game  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, This is my first time posting on Java Ranch Forum.

Here is my problem that I would request for help with. I have created a card matching game using a JPanel as the display are for the game. The game seems to work fine. I still need to solve an issue with the processor, the processor is running at 70% for my simple program. the RAM memory is 25MB. that is quite big compare to Windows solitaire 5MB. I am wondering if my code can be optimize further (reduce size and processor usage.). anyone have any suggestion?

Here are the codes and screenshot attachment of the of my game. My apology if the post is too long.

1. Viewport - to be extended by the main game display


2. BaseFrame - JFrame that will hold the Viewport.



3. MatchDisplay - the actual Display


4. Deck


5.Desk - Place where I put the card


6. Card - finally the last class the card it self.
Screenshot.jpg
[Thumbnail for Screenshot.jpg]
 
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following are my suggestions.

1. You may not implement all *Listeners in the ViewPort class
2. You may create separate *Listener classes and instantiate them to use within the MatchDisplay class
3. You may merge Deck and Desk classes
4. You may eliminate BaseFrame class and do the needful within the MatchDisplay class
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!