|
Thank you for the advice, however, the game will be simple and aimed at one player. It must run in the browser as I must retain full controll of the source code.
The game itself will be very basic, with basic graphics and minimal animation.
I am currently persuing the idea of hosting a c# app in silverlight.
Thank you,
Steve
|
|
|
|
|
Does anyone know of a class library, have example code or an algorithm to determine the optimal number of shipping containers required to transport x stock items? Stock items or varying sizes can be packed into the same shipping container.
We'll have the dimensions of the various stock items and the shipping containers, and would like to feed this and the item quantities being shipped into a routine.
Regards,
Andrew
Andy
|
|
|
|
|
yes, knapsacks are described here[^].
|
|
|
|
|
Unfortunately that article and the related packing problem article [^] are written in a language only mathematicians understand.
Andy
|
|
|
|
|
Capital sigma is summation. And, now that you know the name of the problem, you can google for it.
|
|
|
|
|
|
I have to present a value (as string) into many formats
i.e :
Possibility to converts the data in differents units of measure
Exemple if I have Centimeter
L = 2019.80
and User chooses meter so the new L become
L = 20.19
Also depends on Precision :
if Precision = 2 I have L= 2019.80
and if Precision = 3 I have 2019.800 ...
So can you help me ?
|
|
|
|
|
You need to look into the String.Format methods[^]. The link points to the MSDN page for this.
As for converting lengths i.e from centimetre to metre etc, you are going to have to have some sort of conversion class that does the actual conversion, and then calls String.Format on the result.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
I need to check whether password has at least 6 characters with at least 1 letter and one special character. I am checking the condition !Regex.IsMatch(strPassword,"(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,24})$"). But it doesnot allow special character.
I need to change the expression to check if there is at least one special character.
Please help me out.
|
|
|
|
|
In .NET regex language there is a character class "\W" that represents "non-word characters" (i.e. characters other than letters, digits, or underscores). You could also replace your [0-9] with "\d" (note the lower case).
P.S. I think this question may be better suited for the regular expressions forum.
|
|
|
|
|
I am assuming you consider # and @ to be the allowable special characters:
^(?=.*[#@].*)(?=.*[a-zA-Z].*)[a-zA-Z0-9#@]{6,24}$
Anything that matches that will be a valid password (between 6 and 24 characters, contains only letters/numbers/special characters, contains at least one letter, and contains at least one special character).
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
|
How do you make repeatable backgrounds for things in XAML?
Back when I was working with HTML, I remember having bitmaps as backgrounds for either a page or for an area.
Now I find I want this same sort of thing in my XAML page for Silverlight. How do I do that? How do I make it repeatable so that the image pattern exists across, for example, a header area no matter how wide the browser window is?
|
|
|
|
|
I think this question belongs in the Silverlight / WPF[^] forum.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
|
Hi,
I was just woundering if anyone knows how I would do this...
I have an image of a roulette wheel, and I would like to animate it as it was spinning, faster to slower and then stop.
How would I achive this using c# and winforms, as I am not ready to delve into WPF just yet?
Thank you,
Kind Regards,
Steve
|
|
|
|
|
Yes, WPF makes things like that considerably easier.
No concern though. First thing to do is rotate the image, which is presumably represented as a bitmap in code. Get to the graphics object, and that's got two methods TranslateTransform and RotateTransform (as I recall) which should do the rotation. If everything's perfectly circular you may not need the translate transform. Then, create a method which rotates the image as needed. I'd probably create a custom control for just this purpose.
You'll have to use the System.Windows.Forms timer to update the angle in such a way to make it look like real movement.
Regards,
Rob Philpott.
|
|
|
|
|
Would that be better than using BitBlt and 36 separate bitmaps in memory?
Or maybe creating an AVI and using DirectX?
|
|
|
|
|
DirectX would be overkill, as it would add a lot of complexity before getting anywhere.
Whether 36 separate bitmaps are better mostly depends on how fast GDI+ (which is used by WinForms) can transform the image. If it is real-time enough, then it is fine to do the transform every time (don't forget to keep the original image in memory and do the transform on a copy every time).
If the performance is too low, then you'll need to go for the multiple images (but this will use a lot more memory).
|
|
|
|
|
there are 37 numbers on a roulette wheel (without number zero the casino could be in trouble pretty soon); and you probably also want some intermediate positions, especially when the wheel slows down, so 37*5 images seems more like it.
|
|
|
|
|
|
PIEBALDconsult wrote: 38 in the U.S. -- 00 .
0 for the casino.
00 for the government?
|
|
|
|
|
Heck no, the guv'mint takes more than that.
|
|
|
|
|
Rob Philpott wrote: Yes, WPF makes things like that considerably easier.
I am excited to get started with WPF, however, I think I should get through my "Head First C#" Book first, and learn C# properly.
I will look into what you have sugested, and see if I can get something going.
Thank you for the sugestion,
Regards,
Stephen
|
|
|
|
|
Not entirely on-topic, but... I can't stand games that waste time doing crap like that. Just randomize the number already!
I'll always remember that the Amstrad that my father bought (mid-80s) had a Wheel Of Fortune game installed, but the clock was much slower than the developers had intended -- waiting for the wheel to stop spinning was horrible.
What I recommend is randomizing a number and displaying just that number. Do it a few (10?) times so the user sees the numbers flashing. That's what I do for a dice game I wrote; it's much quicker and easier.
|
|
|
|