Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

puzzle game

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends I’m rather new to Java but determined to learn. I’m trying to make a program that solves a sliding puzzle. A sliding blocks puzzle consists of a number of rectangular blocks that fit into a tray. The goal is to slide the blocks, without lifting any out of the tray, until achieving a certain configuration.

My first task is to create a tray, which I have done, but I don’t know how to fit the blocks on the tray. I want to create something like the picture below (see the textual representation)



Code:

Screen-Shot-2015-04-21-at-23.13.19.png
[Thumbnail for Screen-Shot-2015-04-21-at-23.13.19.png]
 
Marshal
Posts: 70208
280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid you will never solve that by writing code. You need to work out the rules for a game and write down how it is played. Then you can work out how to display the output later.

And why are you using the keyword static so often?
 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Zay Kee wrote:Dear friends I’m rather new to Java but determined to learn. I’m trying to make a program that solves a sliding puzzle...


Could I suggest that that's rather an ambitious project to start with?

I've been using Java for more than a dozen years, and programming for nearly 40, and I'm not sure I'd want to tackle it.

If you're absolutely determined, don't let me stop you; but I fear you're in danger of getting frustrated because you've taken on too much too soon.

Winston
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic