ALGORITHM TO USE TO FIND A SOLUTION TO A POINT GAME

Hi im joseph,

im new to this forum.....

working on assignment called a Card Game...the program select four card images out of 52 card images ... find the solution for the possible algebraic expression out of the four cards selected and the result of the expression must equals 24.... the number of the cards are from 1 - 13..

Re: ALGORITHM TO USE TO FIND A SOLUTION TO A POINT GAME

Welcome, Joseph. What help do you need? Show what you've tried and ask specific questions about the code, post any errors you want help with, etc. It's unclear how you expect to go from 'images' to values to determine the expression and the significance of 24 in this whole business. It might be helpful if you can post the assignment or instructions directly, in English anyway.

While you're pondering that, also read this FAQ for instructions on how to post code correctly and other useful tips for newcomers.

Re: ALGORITHM TO USE TO FIND A SOLUTION TO A POINT GAME

The problem is to write program that accept 4 number from user, and the number must be between 1 to 13 and the program find a solution or algebraic expression from the numbers supplied by the user and the result of the expression must be 24 if not print no possible solution to the user... Already programmed the GUI.

But the logic to get the expression or solution still trying to get. So I thought if I could get some help with an algorithm.

Re: ALGORITHM TO USE TO FIND A SOLUTION TO A POINT GAME

Ah, so an algorithm to solve for a, b, c, and d in the equation:

a * w + b * x + c * y + d * z = 24

where w, x, y, z are supplied by the user and take the values 1 to 13, inclusive, right? I assume that a, b, c, and d cannot be zero. Is that right? Are you to find all possible solutions for each w, x, y, and z, or just A solution?

The brute force method would be to try every combination until some criteria was met that indicated there was no possible solution.

Does that give you any ideas?

Re: ALGORITHM TO USE TO FIND A SOLUTION TO A POINT GAME

Yeah.. Mr greg you get what I was trying to insinuate . Just that the user input would be within the range of 1 - 13 and no other variables inclusive.

And I'm to find all possible solutions w, y, x, z.

Thanks for the idea. Have heard of brute force approach.

Will do the digging about brute force approach tonight.

Thanks.