English
Games

the game NIMM (Textbook-example)

 

p.specht


Window Title "DAS SPIEL NIMM"
' (CL) CopyLeft 2014-09 by P. woodpecker, Wien. No however geartete Gewähr!
' there's for player, the begins a strategy, with the it not lose can.
' To Beginn takes the later Gewinner one match. then depends it itself to seinem
' opponent or. attempts always a Viererzahl To achieve. because if it the opponent in the letzteb
' train as selection 4 Hölzchen präsentiert, can ER the latest Hölchen take and win so.
Windowstyle 24:Randomize : font 2 : declare b&,m&,h&,x&,y&,s$ : h&=9+rnd(21)
Start:
b&=0:m&=0:CLS
Print "\n The Zufallsgenerator places in this round ";h&;" Hölzchen from."
show h&
Print "\n who should begin {1=Spieler, 0=Computer}?: ";:Input b&
print " --------------------------------------------------------"
Loop:

If b&=0 : cls:print "\n The computer is dran."

    else    : print "\n player is dran.     "

endif

inc m& : print "\n ";int(m&/2);". train: yet lying ";h&;" Hölzchen on the table.\n"
show h&

if b&=0

    ' profit-train: possible on a Viererzahl bring
    x&=h& mod 4:case x&=0:x&=1'bad luck for Compi: 0 is not!
    print " computer takes ";x&;" Hölzchen lane.     ":h&=h&-x&
    else :again:
    print " Wieviele Hölzchen would tappt im dunkeln take away {1,2 or 3}?: ";:input y&
    case (y&<1) or (y&>3):goto "nochmal"
    print "\n player has ";y&;" Hölzchen removed.":h&=h&-y&

endif

b&=hardship(b&)
print "\n After the ";m&;". train lying now ";h&;" Hölzchen on the table.\n"
show h&
waitinput 2000

if h&<=0 :print "\n *********************************"

    if b&=0:print " * player win! Congratulations! *"

        else   :print " *      computer has won.   *"
        endif  :print " *********************************"
        print  "\n another game {1=Ja}?: ";:input s$:case s$="1":goto "Start"
        print "\n see again!":waitinput 6000:end

    else

        print " --------------------------------------------------------"
        waitinput 1000:goto "Loop"

    endif

    END

    proc show :parameters h&

        usepen 1,1,rgb(255,255,255):usebrush 1,rgb(255,255,255)
        rectangle 0,13/20*height(%hwnd) - width(%hwnd),height(%hwnd)

        whileloop h&

            usepen 0,7,rgb(200,200,100)
            line &Loop*width(%hwnd)/30,(14*height(%hwnd)/20) - &Loop*width(%hwnd)/30, 19/20*height(%hwnd)
            usepen 0,14,rgb(230,70,0)
            line &Loop*width(%hwnd)/30,(14*height(%hwnd)/20) - &Loop*width(%hwnd)/30, 14/20*height(%hwnd)

        endwhile

    endproc

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



Zum Spiel


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.642 Views

Untitledvor 0 min.
p.specht06/16/22
Stefan8106/11/22
Ernst07/21/21
Sven Bader07/14/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