• 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

'3 in a Row' simplified version

 
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
This is a game i made in the BASIC language several years back. Now, I want to code it using jsp and servlet. It works just like the '3 IN A ROW ' app.
Here is the general idea:
At the start of the game, a page containing numbers running from 1 to 9 is displayed on the screen in the form of a cross as shown below.

The game is played by 2 players. Each of them is represented by an image. They are asked where to go on the cross in a successive manner. For instance if Player 1 says he wants to go to number 8 on the cross, its corresponding image is loaded at position 8 of the cross. They are required to fill 3 positions on the cross and from there they can start moving on the cross. The sole objective of each player is to align its 3 images. A player can only move on its immediate position(right or left) and he cannot move onto an occupied position.
I plan to have the following tables:
Player1
position int(1)

Player2
position int(1)

AllowedMoves
moveFrom int(1)
moveTo int(1)

WinCombinations
win varchar(3)

But my first question is:
How do i load an image at a position chosen by a player on the cross?
Kind regards.
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The cross can't show well in the post. The vertical line contains
1
2
3
4
5

and the horizontal line is
6 7 3 8 9

and they meet at position 3.

Hope i am understood. Note that these numbers are images. I am able to display the cross with default images but i don't know how to render them dynamic.
align-3.png
[Thumbnail for align-3.png]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using JSP/Servlets, you are presumably rendering in HTML. What format is the 3 in a row? An HTML table?
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What format is the 3 in a row? An HTML table?


Yes, it is an html table containing images..
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This is a game i made in the BASIC language several years back. Now, I want to code it using jsp and servlet. It works just like the '3 IN A ROW ' app.


Hey Jeanne,
I was finally able to do it. You can see how it looks like by going to http://paulngom.s156.eatj.com/
And tell me your suggestions or remarks if any after you had tried it. Note that this link will last 11 days. I wish i could play with the computer. Do you think that is possible to reach in jsp/servlet code?
Kind regards
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations. I'm happy to see you got it working.
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wish i could play with the computer. Do you think that is possible to reach in jsp/servlet code?
Paul

reply
    Bookmark Topic Watch Topic
  • New Topic