English
Source / code snippets

Umleer-puzzel for two box solve

 

p.specht

inspired of "Simon-says"-puzzel from the film "Stirb langsam", supply that nachstehende Program possible Umleer-Abfolgen to Erzielung bestimmter Zielmengen - though not always The kürzeste Variante: turn one the two Gefäßkapazitäten circa, yield itself often kürzere ways to that success.

Info: only if a the Gefäßkapazitäten a Primzahl is, or the two mental capacity "relativ prim" zueinander are (GgT=1), go (in both directions) guaranteeing any at all possible Results supplied.


so can too The undertow. two-Sanduhren-puzzel solve. in the Program becomes then determined, How one whom missing Restwert on Time produce can.
Window Title "Umleer-puzzel for 2 box lösen"
declare Ziel&, LMax&,RMax&,L&,R&,n&,kann&,ist&
Beginn:
CLS:Font 2:Print " target = ";:Input Ziel&
' Ziel&=2
LMax&=7
RMax&=11
Case Ziel&<0:ziel&=abs(ziel&)
Ziel&=Ziel& mod if(LMax&>RMax&,LMax&,RMax&)
n&=0:L&=0:R&=0

Repeat

    'If target access:

    if (LMax&=Ziel&) or (RMax&=Ziel&):inc n&:break:endif

        if (L&=Ziel&) or (R&=Ziel&):show:break:endif

            'If something there's to that transport and no capacity spare is: make spare!

            if (L&>0) and (R&=RMax&):R&=0:inc n&: show :Endif

                'If nothing more there's to that transport, schöpfe new!

                if (L&=0):L&=LMax&:inc n&: show :endif

                    'If something there's to that transport and yet capacity spare is: vain circa!

                    if (L&>0) and (R&<RMax&): Umleeren :inc n&: show :Endif

                    Until (L&=Ziel&) or (R&=Ziel&)

                    print " ";n&;" steps."
                    Waitinput
                    Goto "Beginn"

                    Proc Umleeren

                        kann&=RMax&-R& : ist&=if(kann&<L&,kann&,L&)
                        L&=L&-ist& : R&=R&+ist&

                    Endproc

                    Proc show

                        print tab(3);n&;". ";tab(12);L&,tab(20);R&

                        if %csrlin>20:waitinput 2000:cls:endif

                        Endproc

                        END
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.466 Views

Untitledvor 0 min.
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie