im not too sure how to implement this ...
I need to create a weighted oriented graph based on the problem of a water jug from the movie Die Hard 3 ( http://www.wikihow.com/Solve-the-Water-Jug-Riddle-from-Die-Hard-3 ).
I need to create nodes for all possible moves (fill, empty, pour). After I need to find the shortest path to a solution. But it’s hard for me to create this schedule. I use my own created linked list / node.
Any help with the algorithm to create this graph would be great. Thanks.
ex) given 3 gallons, 5 gallons. Get 4 gallons in a 5 gallon jug. I need to create a graph of all the possible steps to get to 4 gallons. Each other gallon is a different node.
Happy Thanksgiving =)
, node - 3- , 5 . , (), "" ( , ) - -, , ; ( ); .. ( , , ). , , ( "" ), "" (, , ), , .
, (0, 0) - , . , (3, 0) (0, 5) ( ) .. , !
6
1. =2 =3.A- > B4.B- >5.A = 06 = 0
. , . .
- A * B, - A * vol (B) + B
[A * vol (B) + B] , . -1 ( , 0 )
Source: https://habr.com/ru/post/1724062/More articles:Do I want to make an exception or mistake in this PHP script? - phpEmbedded board shutdown processing - linuxCSS and font tips - htmlPerformance tuning with SQL Server - performanceAndroid Get Local File Bytes - androidHow to get checkbox values that are marked? - javascriptIs it possible to include a javascript file that is in an archived file? - javascriptЗначения по умолчанию в Insert Select в SQL - sqlВсегда ли оправдано писать достаточно большое, основанное на базе данных PHP-приложение процедурно и без MVC? - oopXlib and ButtonPressMask Mouse Events - pointersAll Articles