Gauss Rifle with electromagnets? any ideas on how to wire up a series of small e.m.s?

My thought is this; if you had a series of electro magnets lined up to make a gauss rifle who could you A) make electromagnets small/strong enough and B) either wire it or program it so that they turn off/on in a specific pattern. For those who don't know, what I'm looking to build will look roughly like this but using electromagnets instead