123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|538|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Mini Challenges -> Challenge : Number Game

Sat, 06 Dec 2008, 16:09
Phoenix
Since my last challenge wasn't very exciting (the pangram one), here's a slightly more programming related one. I found this question off another site, and I thought it would be fun to solve.

Given a certain expression, you're supposed to insert plus and multiplication signs to it so that it becomes valid. For example, "123=7" would have to be turned into "1+2*3=7" to be valid.

Some expressions have many solutions such as "12345=15", which can be either "1+2+3+4+5" or "1*2*3+4+5". Or "23456237490=1185" which has 5 solutions.

Speed isn't important -- just try to solve it! I'm not posting my solution yet, cause I'd like to see how everyone else goes about it without being influenced by me.
Sat, 06 Dec 2008, 16:55
Jayenkai
So, Countdown then

The Numbers game on Countdown involves a set of numbers (1-10, 25, 50, 75 or 100) and a random 3 figure number.. The players have 30 seconds to solve it, if indeed it's even possible.
See here

So.. would the numbers need to be in the order given?

-=-=-
''Load, Next List!''
Sat, 06 Dec 2008, 19:34
Stealth
I wrote this PHP script, but it only works if the answers are in this format:

1 * 2 * 3 + 4

Where the multiplication signs are all bunched up at the front and all the addition signed are at the end.

I realised after I wrote this code that it had that major flaw in it, and trying to get it to work properly would take a massive amount of time. None-the-less, I'll post what I have.



-=-=-
Quit posting and try Google.
Sun, 07 Dec 2008, 05:51
Phoenix
I could never be in that Countdown game -- it looks really hard! Never seen that show before. Don't think we've ever had it over here.

And no, the numbers shouldn't have to be in order.
Sun, 07 Dec 2008, 06:13
Afr0
"123=7" would have to be turned into "1+2*3=7" to be valid.


3 * 3 is 9, not 7. Did I miss something here? :\

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Sun, 07 Dec 2008, 06:14
Jayenkai
1 + (2*3)
Sun, 07 Dec 2008, 09:17
CodersRule
3 * 3 is 9, not 7. Did I miss something here? :\


Order of operations.
Sun, 07 Dec 2008, 10:56
Phoenix
At first glance, I have absolutely no idea what's going on in that code there but I'm going to have a second look

I'll admit that I was a bit unclear. Originally I intended the implementation to allow several digits between operators, but I'm not smiting anyone for doing one way or another. It's just a thinking exercise.

Here's my rather lengthy (in comparison) solution in C#.
Mon, 08 Dec 2008, 03:23
Jayenkai
Aaaah, good old fashioned Brute Force!!

Countdown Number Solver

Works for both this, and Countdown...

It isn't perfect, though.. it occasionally misses one before the time's up..


Probably best to turn off debug, too!!

-=-=-
''Load, Next List!''
Mon, 08 Dec 2008, 09:58
Phoenix
Nice sound effects there Checking all solutions seems to be the only way, because I've no idea how to solve this without employing our friend Brute F. Orce.

So... who's got other programming challenges?
Mon, 08 Dec 2008, 19:08
Mog
I'm considering having a programming challenge to see who could make a game that utilizes an Essential Reality P5 glove. The best idea would win one for free from me, think of it as a prize challenge here at SoCoder ;P



Read up on this little device and let me know what you think.

-=-=-
I am Busy Mongoose - My Website

Dev PC: AMD 8150-FX, 16gb Ram, GeForce GTX 680 2gb

Current Project: Pyroxene