Регистрация | Вход
Graphics 640,480,24,2font=LoadFont("system")SetFont(font)Global weight#=0.5Global LastError#=1Global Smoothing#=0.5Function Ns_train(v1#,v2#)i=0While(LastError > Smoothing Or LastError < -Smoothing)i=i+1Train(v1,v2)Print "iteration "+i+" error "+LastErrorIf LastError<1 ReturnWendEnd Function Function ProcessInputData#(input_#)Return input_*weight;End FunctionFunction RestoreInputData#(output#)Return output/weight;End FunctionFunction Train(input_#, exResult#)aRes#=input_*weightLastError=exResult - aRescorrection#=(lasterror/aRes)*Smoothingweight=weight+correctionEnd Functionv1=Input("v1> ")v2=Input("v2> ")Print "Ns_train v1 " + v1 + " v2 " + v2Ns_train(v1,v2)Print "train end"inp=Input("input> ")Print " ProcessInputData input "+inp+" "+ProcessInputData(inp) WaitKey()
Global g_text_pos = 0;Global g_text$;Global g_text_word$;Function TextBegin(text_$) g_text=text_ g_text_pos = 1 g_text_word=""End Function Function TextReadWord() g_text_word ="" If (g_text_pos > Len(g_text))Return 0; While (Mid(g_text,g_text_pos,1) = " ") : g_text_pos=g_text_pos+1 : Wend While (Mid(g_text,g_text_pos,1) <> " " And g_text_pos<=Len(g_text)) g_text_word =g_text_word+ Mid(g_text,g_text_pos,1); g_text_pos=g_text_pos+1 Wend g_text_pos=g_text_pos+1; Return 1;End Function
;сюда код сверху;можно код сверху в файл например text.bb;и использовать;include text.bb;так создавать свою библиотеку создаем библиотеки делимсяGraphics 640,480,24,2font=LoadFont("system")SetFont(font)text$="one two three"Print TextTextBegin(text)while(TextReadWord()):print g_text_word:wend;waitkey()
Graphics3D 640,480,24,2SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5EntityType(camera,1);EntityRadius(camera,1.5)GenMap();plane=CreatePlane() EntityPickMode(plane,2)sphere=CreateSphere(8)EntityColor(sphere,255,0,0)PositionEntity sphere,0,1,0frameTimer=CreateTimer(25) ;Global trg=CreatePivot();Global pivot=CreatePivot();While Not KeyDown( 1 ) If MouseHit(1) ThenCameraPick(camera,MouseX(),MouseY());PositionEntity(trg,PickedX(),1,PickedZ());EndIf;If (EntityDistance(camera,trg)>1) ThenPointEntity(pivot,trg)TurnEntity(camera,0,DeltaYaw(camera,trg)/10,0);MoveEntity (camera,0,0,0.1 );PositionEntity(camera,EntityX(camera),1,EntityZ(camera));RotateEntity(camera,0,EntityYaw(camera),0);EndIf;Collisions(1,7,2,2);UpdateWorld()RenderWorld WaitTimer(frameTimer)Flip Wend End Function GenMap(); Main loop to create multiple random objectsFor i = 1 To 100 ; Create 50 random objects CreateRandomObject()NextEnd Function; ; Function to create a random objectFunction CreateRandomObject() x = Rnd(80) ; Random x position z = Rnd(60) ; Random z position objectType = Rand(3) ; Randomly choose an object type (0, 1, or 2) If objectType = 1 obj = CreateCube() ; Create a cube If objectType = 2 obj = CreateSphere() ; Create a sphere If objectType = 3 obj = CreateCylinder() ; Create a cylinder PositionEntity(obj,x,1,z) EntityColor(obj,Rand(255),Rand(255),Rand(255)) EntityPickMode(obj,2) EntityType(obj,7)End Function