How would I approach building a results predictor for a Football Management sim? [closed] - simulation

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking for some food-for-thought on how games like Football Manager and Championship Manager achieve a fairly high level of realism when it comes to simulating realistic scorelines. I am conscious that some of these algorithms would probably fill shelves but I'm looking for a more lucid overview.
Even some pseudocode which outlines how the different player attributes are pitted against each other during the game loop would be very interesting.
I'm looking to do a small project in my spare time for the Windows Mobile platform and would be grateful for any information that would help!

My guess is that such algorithm is a trade secret for game companies like SI Games and such, and you won't find any hint about their algorithm in public places.
You can look at open-source football management games, like bygfoot.

You might want to take a look at my project, which is a football (soccer) match simulation:
http://sourceforge.net/projects/openfootie/

If you are able to collect enough information about the results of the past matches, you could make a simple multiple regression model to predict the scores with reasonable amount of accuracy. You'll have to select your variables carefully though.
Check out this and this for more information on prediction using regression techniques.

Certainly a component of any such algorithm would be analyzing the past X-many years of actual football scores: professional, college, and high-school.
If you were to aggregate the data available on merely active, professional players, then look at the scores of every game they were in, you could start to get one possible approach.
For example, maybe there's a place-kicker who just freezes-up against one team - and therefore the coaches don't put him on the field after that when the two teams are playing each other.
Obviously, such analysis should be done ahead of time and NOT on the Windows Mobile device :)
However, it could be at least a reasonable starting point.
Also, be sure to not rely on pure statistics - it doesn't matter how good you are if Lawrence Taylor breaks Joe Theismann's leg :-\

There are some open source football sim engines you may want to take a look at:
ESMS+
BygFoot
I would say its difficult to determine what is the "correct" method for developing an engine for this type of game. I think its basically how you think it should be determined....obviously having a sneak peek at other people's source code helps :)
I haven't had the time to take a look at BygFoot's yet, however, I have had a look at ESMS and it doesn't look too bad! The main loop is not as big as you would think....
I would say there must be an element of randomness involved, this will allow for "shock" results etc and you should also take into account things like recent form, player morale, fitness, stamina, home/away and provide bonuses to the players accordingly.
Hopefully that helps!

Related

Siemens PLC programming best practices [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
My question is pretty simple. Is there any useful place for learning to work with Siemens PLCs?
Full Disclosure:
I was a Software Engineer for Rockwell Automation working with their A|B PLCs
You probably won't like my answer
To put it plainly programming PLCs whether you're using Ladder Logic, Structure Text, Instruction List, Sequential Flow Chart, FBD, or Continuous Flow Chart isn't the same as programming software in a language like C++, Java, JavaScript, etc...
Simply put, there is not one set of "best practices" that fits every use case. The reason for that is, because unlike your standard software development which you can apply principles like the SOLID principles to always make your code easier to read, maintain, and extend. PLC programs are associated with a very real physical process and physical machinery. Often times what you find in the industry is that every plant/manufacturer/facility establishes their own set of best practices given their facilities needs and process.
To give an example:
Scenario 1:
The logic used to run the distillation process for a small local brewery may include sub-routines or even a loop. They may allow 5 or less warnings in their code, and allow a few unused tags. That is totally fine, because they are making beer, the process isn't critical, a bad batch won't kill anyone, and they only have 2 pumps that their using the logic to iterate over. So if there is a problem that needs trouble shooting the logic in the sub-routines or loop won't be too much of a headache.
Scenario 2:
I am a global pharmaceutical company producing 100's of millions of life critical drugs each year (say insulin). Now my logic is has zero sub-routines, no looping, I have zero tolerance for errors or warnings, and absolutely no unused tags. Why, because I am a highly regulated industry and if their is an issue with one of my products, people may die. Also why no sub-routines or looping, because I am a huge company with hundreds of pumps, mixers, etc... When one of those pieces of equipment go down I don't want to look at some horrible looping logic that is responsible for the logic of hundreds of pumps. I want to look at one select piece of the logic that I can quickly understand, correct, and get my line back up and operating.
I am sure you can find some articles or courses out there (like the one you already took) that explains some basic "best practices", but in the real world you will need to adapt your logic to every individual scenario in order to achieve the best outcome. That is my humble two cents on the matter, best of luck to you!
Udemy - there are some courses there, though I haven't tried them myself.
I've watched lots of useful videos on YouTube.
http://www.plcdev.com/siemens_simatic_step_7_programmers_handbook -
quite old, but could be usefull.
Siemens forums, official manuals, guides. There is lots of info there, quality varies sometimes, but mostly good.
BTW, a nice thing about Siemens is that you can often look up things just by searching the web. That is not the case for some other PLCs...
Good luck!
If you work already in a factory. Read the code that's run in PLC-s. And start modifying it, if needed. Thats how i started, I was initially lowly automation guy. Pulled cables, changed broken sensors etc.
If you don't, and you need a break to the field, then as ordinary tech worker, the path is usually from electrician or automation engineer. Or as entreprenuer/independent contractor, i have seen people just do it. Like win a contract for some public company request, do some schematics, write code, do electrical montage all by themselves. Or just do parts of it with other contractors. You need previous experience to pull it off
As for some practices:
If you are modifying existing code. Always use existing style, existing functions and blocks.
Do not use programming patterns from ordinary IT world in low PLC code. Or use with caution. Reason for this is that your code probably has to live for years and years, and has to be debuggable. Patterns usually add layers of complexity, complexity leads to harder debugging. In automation world it's usually better to debug stuff thats closer to hardware.
If you are starting to make project where you have tens or hundreds of sensors/motors/actuators, start using reusable blocks.
All best practices are learned in the field, sadly theres no other way. I know it's kind of catch22 sometimes. Need work to get experience, need experience to get work. I entered automation world, and later IT world the same way: get a job and the low end, maintanence guy or junior IT developer, gather experience, in a year or two you will be in mid-level.
And don't lose any of those constraints while your programming PLC :
PLC programming is very low level programming
memory size matters, each byte must be important
logical have to be concise and as short as possible : sometimes you have to be good in math !
the machine you're working on is dangerous and can provoque product, equipment or human damages
the machine you're working on is expensive and is built to produce for years
It's the same as in computer programming : each programmer has its own way to program, there's no truth. Sometime you'll find some interesting existing code : don't hesitate to re-use it if it looks smarter and is more efficient.
Find your way and keep in mind the machine you're working on is dangerous for you and the people walking around (it's not always the case but it's important to keep this in mind while programming).
And moreover: don't forget the first rule in industrial automation : if it runs correctly, don't touch it !

Start a neuronal network project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
after a long term of reading the theory behind neural networks I finally want to stark to do my own project in object recognition.
However I struggle to find a practical entry point. I want to use either C#,C++ or C however all new tutorials seem to involve newer languages such as python.
For starting I would especially like to reprogram the theory concepts of Yann LeCuns publications about object recognition.
Which programming language is recommended to use? And much more important: Which framework do I use? There seem to be docents of frameworks (AForge, Apache Mahout, OpenCV) and my theoretical knowledge seems to be too impractical to differentiate the usage of these.
I want to program a simple independent neural network application which should be easy trainable plus I don't want to reprogram classes such as neuron or layer in order to focus on the architecture for the beginning.
Thanks and sorry for the simple probably often ask question, however I just couldn't find anything matching.
Greetings
Nex
disclosure: i'm not an expert.
depends on what exactly you want to do.
if you want to build something from scratch, probably the easiest language to start prototyping is matlab/octave because it's high level and offers pretty fast matrix manipulations, nice math support (like numeric derivatives) and robust plotting to quickly verify your models. when you have your prototype, you can port to to c/c++ to make it faster, more space efficient, portable etc.
if you want to just use exiting tools/techniques and just play with parameters (preprocessing, feature selection etc) to find the best model for you, i would recommend start from R and caret package or python (don't remember the package name)
if you want to use NN in cluster on big data then i would try using existing frameworks like openCV (not sure if mahout provides NN)
Google just released their tensorflow framework.
Its perfect to start with and offers even for high skilled NN-architectures a lot of feautes. I highly recommend it for everyone.

How many man-hours should I estimate for this iPad app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Background: I've developed an iPad/iPhone app of my own before. This will be my first app for a client. I have no experience estimating the number of hours it will take, since all of my prior iOS development has been off the clock.
I'd like to get a very general recommendation for how long it would take a knowledgeable iOS developer to develop a simple PDF-viewing app for a clients' existing PDF book series. For something of that scale, what would you ballpark-estimate your hours? 10 hours? 25? 50? 100?
I know estimates are hard to get right and it depends on the developer, having carefully-planned requirements, and the like. I will take those precautions and refine the estimate to better match well-outlined requirements. I'm a competent developer, I just don't know where to start in terms of estimating time.
In the back of your head you have a gut reaction estimate in mind.
Take that estimate and triple it. Seriously, we developers are notoriously optimistic as a rule.
This sets a good base line with some padding.
Track it heavily and use the data to make future estimates.
This is very subjective. You'd need to look back and add up the hours you spent on your previous apps to get a idea. One thing I can lend you is take your estimate and add on 30% for unforseen issues.
A general PDF Viewing app shoudln't take too long depending on how fancy you want it to be. Is it a bare bones or will it have add on features? A basic Iphone app go with 25-50 hour marker (Roughly a week and change). Perhaps make it 80 Hours (Two full weeks) to give you some breathing room.
Once you're through your first week you'll have a better grasp of how much time you'll need.
Keep in mind my guess assumes you working alone doing only basic testing and validation and not including any client required test time or review time etc.
You could break the app up into parts and time yourself for building one piece. Then it is a matter of how long will the other pieces take relative to your test piece.
Example:
Part A (test) 1.5 hours
Part B 3 times as long
estimate 4.5 hours.
Try to do the test under normal development times and you energy level.
at least 100 bro! Apps are hefty.

Looking for ideas on a class project in Computer Vision [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have come upon another class where I need to find an idea for a project, and since my last posting on SO for a project idea was so successful, I've decided to ask here again.
I'm taking a class titled Computer Vision for Human-Computer Interaction, and we need to come up with a few ideas for a project that we will have about 2-4 weeks to complete. We have the option of working with 1 or 2 other people, although I will probably be going solo on mine.
In the class we've covered things like image formation, image features, segmentation, shape analysis, object tracking, motion calculation, and some applications. Our homework assignments have been completed in Matlab for convenience, although its not required for use in our project.
I have come up with few possibilities: tracking the motion of a golf club and ball in full swing and doing some analysis, or possibly using eigenface techniques to do some sort of facial recognition and matching.
I would enjoy building an application that I can put on the web for others to play around with, but most of all I want to complete a project that could be of good use to someone (whether for entertainment or more useful purposes).
So... any ideas? Thanks!
Its fun and challenging to go from static image processing to doing analysis in real-time. For example, analyze video from a webcam and have the user play a primitive video game by waving their hands.
Or, if you want to continue with your face recognition idea, try writing software to highlight famous faces in a running video in realtime.
Use google image search to gather training data and then see how well your software can do at identifying the president of the US in different settings , for example. Can you train all of the former presidential candidates and differentiate them all?
Also, look into using OpenCV for fast real time computer vision processing in C.
Take a look at these for examples:
http://en.wikipedia.org/wiki/Category:Applications_of_computer_vision
http://www.cs.ubc.ca/~lowe/vision.html
There are some funky projects in this ongoing course:
http://www.seas.upenn.edu/~cis581/

For a large project, what planning should be done before coding and how should it be approached? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
What is your method of "mapping out" an idea before creating it?
Say I wanted to take on a big project, for example at the scale of a site like Facebook or MySpace. What planning/design steps should I take before I start the actual work?
For example, should I map everything out page by page (their functionalities, data, etc.)?
For a large project first think of a one-liner to description of your site (try to not use any buzzwords here). Next think of three design maxims (rules your design Should never conflict with). Then draw a few views and think up a few user cases (1 day) then work in code for 2 weeks (this will be a throw away prototype so just work as fast as you can forget about bugs and details, don't worry about code smells or design patterns, just make as much as you can), then revaluate all the steps above and throw away your two week prototype, and begin your project in a serious manner applying solid engineering and design. After a month has gone by evaluate your(team) moral and get feedback. If it all seems to be going ok, continue, you got a long ride ahead, otherwise just give up, do a postmortem, and start over with new goals.
I always start with the user interface design. I figure out what the user should be able to do and what controls I will give them to do it. Once I get that laid out in a way I like it, then I start with the code "wiring".
Make a list of all the features that site have.
Make a list of nice to have features.
Make a list of the weakness of the site.
Order that list and prioritize the items that will be built first.
Identify what will be possible to do and what is not.
Meet with your customer and present these results.
Usually I do a mindmap of
problem I am trying to solve,
translated into exact requirements,
then mapping that to user workflows.
The cross linking features of mindmapping softwares make it lot easy. Since mindmapping is 'kind of freeform', I end up concentrating on the 'task' rather than 'representation' (e.g which type of UML diagram should I use to represent this) ?
Once initial ideas are clear then I can work on project plan, spec/design documents using UML for more low level details. This approach usually works well for me.
To see if it works for you or not, you can use FreeMind (opensource mindmaping software, good but currently limited functionality). Then You can try Mindmanager or iMindmap for mindmaping. Both integrate well with other Office products.
Usually I start out by grabbing my scratchbook and just start writing down what I want as in terms of features, this should be quite detailed. And can be quite messy with every thing scrambled together, if so, when you're done make an 'official version' of you're ideas on paper (REAL pen and paper works best for this in my opinion).
Then I start making some scetches of how the pages would look like, what information it must contain and translate that to a global database design. Then work that global design to a more advanced level where all pages come together, with relations between tables and stuff.
After that I build up the most important pages on a code framework (I always make use of a framework, if you don't then forget the framework part), and by 'most important pages' I mean in for example a blog that would be the posts. After that build the not-so-important pages, in case of a blog that could be an archive of posts.
If you have that done, put the code together with a design, or do that while coding if you do not seperate code from HTML/CSS/JS.
Oh and yes, do NOT expand your first idea along the way. Just write that down and implement that afterwards. So if, in case of the blog again, you think half way you want Youtube tags in you're BB-code, write it down. Add that later, offcourse before you're initial site releases.
That's my workflow, at least a basic basic, basic description of it.
Start with "paper prototypes", i. e. take a pencil and sketch each page very roughly. This lets you start from the user perspective, which I think is a good idea.
You can then use the sketches for a first hallway usability test and later as the basis for "wireframes" you would give a web designer to work from.
If you've gone through the complete site once, you probably have a good idea of what the backend should be able to do. You can now use your page sketches and compile a list of the actions a user can trigger by clicking on things. This is the raw material for designing the server-side API that the frontend can call.
Using the calls that need to be served, you can design the backend: What functionalities group nicely, what data needs to be fetched, what do you need to store between page calls (== Session variables) etc.
In this process, I have fared quite well by postponing technology decisions (frameworks, protocols etc.) and even class structure etc., until I've gone through the whole thing once in terms of "what things should do what to what other things" (I guess there's a better term).
I think I would start with an open-source SNS solution that comes close to what you need and then figure out how to add use-specific plug-ins, modules, and themes that achieve your purposes. There are a lot of em out there. Building from scratch is going to take a lot more effort and planning. Most SNS functionality is not worth re-inventing. Focus on what will make your site unique and build upward toward that.
I'm a fairly visual person when it comes to designing software so I sketch out dataflows, class hierarchies, UI and flow charts on whiteboards and paper first.
Butcher paper and colored pens can be particularly fun to use as it's 3 feet wide and comes in 100 foot rolls. When you've got a design that's satisfying or sufficiently complete, tear it off the roll and pin to the wall. Update as necessary.
That technique has worked for some large refactors as well as new projects.
You could start with something very simple and then add features a little at a time. You may reach a point where you want to start over, but the groundwork you did will be beneficial. Or you can try to do the whole thing at once, in which case you'll need the advice already given in the other replies.
One more idea: Specify those features you are not going to include, and other restrictions. These are called constraints, and are as important as the rest of the plan, as it gives you boundaries so you know when you're done planning!
If you work for the same company as this person, start by getting everything in writing so you aren't the one to take the fall when the inevitable happens...