• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need mentoring on writing my own program  RSS feed

 
Nikos Tsouktakos
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking into making a program, that will find out the optimal first eleven (in football or soccer for americans) amongst 25 or 30 players.
This is going to apply for a computer game: "Football manager 2015"

I was thinking one class would be the player class that is going to have the variables:

player_number (unique) integer
name string
position (there are eleven positions)
position_rating for each position capable of playing

constructor would be add_player(int number, string name)

and a method would be add_position(position, position_rating)

one player can have more than one positions


another class would be the position
position name (unique) string

thats all I can think of now.

the main class would do a loop

starting with a random or defined position it would do all combinations of every single player into each position.
For example it could start with center forward position. There are 5 available players for that position. Lets say the program picks the first player that is also capable of playing in wide position. If the player is picked for center forward he is not avaialable for wide position.
Then the program would move to the wide position and lets say there are 4 players available. It would pick one.
Once 11 players are selected it would add the 11 ratings.
and start over for a different player in center forward position.
at the end of all loops it would print out the 11 players into their respective positions that got the best score.

I am not looking for a solution. I would be glad to do this myself.
However a little mentoring as where to start, what questions to ask myself, a little guidance would be needed.
I am a little dizzy right now after studying for 3 days straight so I hope the presentation was not horrible.

If this is on the wrong sub forum, could a moderator please move it?
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nikos Tsouktakos wrote:I am looking into making a program, that will find out the optimal first eleven (in football or soccer for americans) amongst 25 or 30 players.
This is going to apply for a computer game: "Football manager 2015"

Well, first off: Kudos for thinking about this as an isolated problem

I was thinking one class would be the player class that is going to have the variables:
player_number (unique) integer

I think "ID" might be a better name, since "number" usually refers to a player's shirt number.

position (there are eleven positions)

Really? Doesn't that depend on what formation the team plays? For example, as I recall, some have a "Sweeper", some don't.

position_rating for each position capable of playing

Which suggests to me that you'll need more than one position. It might also be worth considering a "PlayerPosition" or "RatedPosition" class that extends Position to add a rating; then you don't have to have two fields (or arrays) in the Player.

constructor would be add_player(int number, string name)

No it wouldn't. A constructor always has the same name as its class.

and a method would be add_position(position, position_rating)

Seems reasonable.

one player can have more than one positions

See above.

another class would be the position

Which should be Position (with a capital 'P').

the main class would do a loop starting with a random or defined position it would do all combinations of every single player into each position
...
I am not looking for a solution. I would be glad to do this myself.
However a little mentoring as where to start, what questions to ask myself, a little guidance would be needed.

Well, about the only thing I can think of is that presumably, given a particular formation and set of players, you want to pick the team with the best combined rating, which doesn't necessarily mean picking the best player available for each position.

For example: You might want to pick the second best centre-forward if the best one is also a great winger, and picking him as CF would leave you with a worse combined rating than if you picked the second best and made him a winger.

I forget what this type of problem is called (maybe somebody can help me with my Alzheimer's ) but, as I recall, it's not particularly simple.

Winston
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't call methods things like add_position. The correct Java® convention is to call that addPosition. Avoid _s in identifiers except for CONSTANT_VALUES and package names.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!