使用6个数字查找目标号码 [英] Finding target number using 6 numbers

查看:149
本文介绍了使用6个数字查找目标号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

所以我需要制作一个能解决以下任务的AI:

它有一个目标号码(1-999),4个随机数字(1- 9)来自(10,15,25)的1个随机数和来自(50,75,100)的1个随机数

使用4个基本操作(+ - * /)并且不重复任何数字,制作目标数字(或者你最接近的)。不允许同步数字(等等从4 4中生成44)。你不必使用你给的所有数字。







有没有人有关于如何实现这个目标的想法?



我尝试了什么:



我尝试过蛮力方法 - 获取可以从这些数字和运算符中得到的每个可能的表达式,并尝试将其结果解析为波兰表示法。

但是,可能的字符串数量非常多高和计算机无法在合理的时间内完成。

Hello everyone
So i need to make an AI that solves following task:
It has a target number(1-999), 4 random numbers (1-9) 1 random number from (10, 15, 25) and 1 random from (50,75,100)
Using 4 basic operations (+ - * /) and without repeating any number, make the target number (or the closest you can get). Concating digits isn't allowed (etc make 44 from 4 4). You don't have to use all the numbers you are given.



Does anybody have any idea on how to achieve this?

What I have tried:

I've tried the brute force approach- get every possible expression that can be made from those numbers and operators,and try to parse it's result as polish notation.
However, number of possible strings is extremly high and computer fails to do it in reasonable amount of time.

推荐答案

这看起来像家庭作业,我们不会为你做。

这也是一个非常常见的家庭作业任务,这就是为什么搜索引擎会发现你有200多万个选项可供查看。



你可能想从这开始CodeProject文章倒数数字拼图解算器 [ ^ ]
This looks like homework, which we will not do for you.
It's also a very common homework task which is why a search-engine would have found you over 2 million options to look at.

You might like to start with this CodeProject article Countdown Number Puzzle Solver[^]


这篇关于使用6个数字查找目标号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆