Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Queries about Ludo Logic

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I trying to make a Ludo game. I have made engine that works with only 1 player i.e. it only runs with 1 player. I have tried hard to work make it work with two or more players but could not succeed. I have made an object for 1 player but when I make objects for other players, I don't get the desired result in the command output. such as I want this output in the command output:

-y-b--y-b--y-b---y-b--y-y ( the 'y' is twice because its overlapping the b in the same position.)

Where as I am getting the following result:

---b----b----b-----b----b
-y----y----y-----y----y-y

please need help in solving the problem
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Original Poster: Well I read your questions few times,before I could get what you are asking for.
My suggestions are:
1)Please Post some code with comments which will help fellow ranchers to take a look and let you know what is going wrong.
2)Create an simple array[][] which will keep the board condition.
3)write separate methods method for different of players.// public int[][] Player1(int[][]board){ int piece_color,int sq; .. use your logic here, return board; }
4)write a method which toggles players (hint use a counter, and switch statement).

If you are still stuck, then kindly post some part of you code which might help to see where the thing goes wrong.
-Take Care.
 
Sadaqatullah Noonari
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashish Schottky wrote:@Original Poster: Well I read your questions few times,before I could get what you are asking for.
My suggestions are:
1)Please Post some code with comments which will help fellow ranchers to take a look and let you know what is going wrong.
2)Create an simple array[][] which will keep the board condition.
3)write separate methods method for different of players.// public int[][] Player1(int[][]board){ int piece_color,int sq; .. use your logic here, return board; }
4)write a method which toggles players (hint use a counter, and switch statement).

If you are still stuck, then kindly post some part of you code which might help to see where the thing goes wrong.
-Take Care.



Thanks that worked. and gave correct results
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic