From 9e19d8433c3714d31731631c7e7190e0da848892 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 16 Jul 2015 22:17:54 +0200 Subject: [PATCH] Removed old CBot-related files --- src/CBot/idees.txt | 42 --- test/cbot/scenarios/B.txt | 18 -- test/cbot/scenarios/BUG2.txt | 107 -------- test/cbot/scenarios/Deleted.txt | 23 -- test/cbot/scenarios/MaClass.txt | 16 -- test/cbot/scenarios/Mc2.txt | 4 - test/cbot/scenarios/Mon fichier.txt | 2 - test/cbot/scenarios/Nop.txt | 4 - test/cbot/scenarios/POS.txt | 14 - test/cbot/scenarios/T.txt | 4 - test/cbot/scenarios/TESTALL.txt | 161 ------------ test/cbot/scenarios/TestCB1.txt | 18 -- test/cbot/scenarios/TestCBot1.txt | 27 -- test/cbot/scenarios/TestCBot3.txt | 24 -- test/cbot/scenarios/TestNull.txt | 15 -- test/cbot/scenarios/TestRestoreState.txt | 67 ----- test/cbot/scenarios/TestStatic.txt | 31 --- test/cbot/scenarios/TestStr.txt | 17 -- test/cbot/scenarios/Z.txt | 14 - test/cbot/scenarios/a.txt | 312 ----------------------- test/cbot/scenarios/bug.txt | 12 - test/cbot/scenarios/bugmw.txt | 9 - test/cbot/scenarios/ccc.txt | 8 - test/cbot/scenarios/enum.txt | 9 - test/cbot/scenarios/fibo.txt | 25 -- test/cbot/scenarios/file.txt | 70 ----- test/cbot/scenarios/h.txt | 5 - test/cbot/scenarios/include.txt | 27 -- test/cbot/scenarios/intrinsic.txt | 16 -- test/cbot/scenarios/methode1.txt | 57 ----- test/cbot/scenarios/methode2.txt | 50 ---- test/cbot/scenarios/mp1.txt | 25 -- test/cbot/scenarios/mp2.txt | 28 -- test/cbot/scenarios/mw.txt | 16 -- test/cbot/scenarios/null.txt | 5 - test/cbot/scenarios/opnew.txt | 20 -- test/cbot/scenarios/plante.txt | 25 -- test/cbot/scenarios/pointer.txt | 41 --- test/cbot/scenarios/postinc.txt | 7 - test/cbot/scenarios/radar.txt | 39 --- test/cbot/scenarios/solution.txt | 13 - test/cbot/scenarios/test.txt | 8 - test/cbot/scenarios/test23.txt | 10 - test/cbot/scenarios/testmw.txt | 14 - test/cbot/scenarios/this.txt | 13 - test/cbot/scenarios/tt.txt | 12 - test/cbot/scenarios/tt2.txt | 5 - test/cbot/scenarios/vide.txt | 0 test/cbot/scenarios/zz.txt | 6 - 49 files changed, 1495 deletions(-) delete mode 100644 src/CBot/idees.txt delete mode 100644 test/cbot/scenarios/B.txt delete mode 100644 test/cbot/scenarios/BUG2.txt delete mode 100644 test/cbot/scenarios/Deleted.txt delete mode 100644 test/cbot/scenarios/MaClass.txt delete mode 100644 test/cbot/scenarios/Mc2.txt delete mode 100644 test/cbot/scenarios/Mon fichier.txt delete mode 100644 test/cbot/scenarios/Nop.txt delete mode 100644 test/cbot/scenarios/POS.txt delete mode 100644 test/cbot/scenarios/T.txt delete mode 100644 test/cbot/scenarios/TESTALL.txt delete mode 100644 test/cbot/scenarios/TestCB1.txt delete mode 100644 test/cbot/scenarios/TestCBot1.txt delete mode 100644 test/cbot/scenarios/TestCBot3.txt delete mode 100644 test/cbot/scenarios/TestNull.txt delete mode 100644 test/cbot/scenarios/TestRestoreState.txt delete mode 100644 test/cbot/scenarios/TestStatic.txt delete mode 100644 test/cbot/scenarios/TestStr.txt delete mode 100644 test/cbot/scenarios/Z.txt delete mode 100644 test/cbot/scenarios/a.txt delete mode 100644 test/cbot/scenarios/bug.txt delete mode 100644 test/cbot/scenarios/bugmw.txt delete mode 100644 test/cbot/scenarios/ccc.txt delete mode 100644 test/cbot/scenarios/enum.txt delete mode 100644 test/cbot/scenarios/fibo.txt delete mode 100644 test/cbot/scenarios/file.txt delete mode 100644 test/cbot/scenarios/h.txt delete mode 100644 test/cbot/scenarios/include.txt delete mode 100644 test/cbot/scenarios/intrinsic.txt delete mode 100644 test/cbot/scenarios/methode1.txt delete mode 100644 test/cbot/scenarios/methode2.txt delete mode 100644 test/cbot/scenarios/mp1.txt delete mode 100644 test/cbot/scenarios/mp2.txt delete mode 100644 test/cbot/scenarios/mw.txt delete mode 100644 test/cbot/scenarios/null.txt delete mode 100644 test/cbot/scenarios/opnew.txt delete mode 100644 test/cbot/scenarios/plante.txt delete mode 100644 test/cbot/scenarios/pointer.txt delete mode 100644 test/cbot/scenarios/postinc.txt delete mode 100644 test/cbot/scenarios/radar.txt delete mode 100644 test/cbot/scenarios/solution.txt delete mode 100644 test/cbot/scenarios/test.txt delete mode 100644 test/cbot/scenarios/test23.txt delete mode 100644 test/cbot/scenarios/testmw.txt delete mode 100644 test/cbot/scenarios/this.txt delete mode 100644 test/cbot/scenarios/tt.txt delete mode 100644 test/cbot/scenarios/tt2.txt delete mode 100644 test/cbot/scenarios/vide.txt delete mode 100644 test/cbot/scenarios/zz.txt diff --git a/src/CBot/idees.txt b/src/CBot/idees.txt deleted file mode 100644 index 3f335da4..00000000 --- a/src/CBot/idees.txt +++ /dev/null @@ -1,42 +0,0 @@ - -for managing instances of a class. - -the object being created with CBotVar :: Create (name, pClasse) - is to keep as is, outside the vars on the stack - - we need another type of variable to keep the pointers - For example CBotTypPtClass - - The instance of the class must have a usage count - which is the number of class object to which they refer CBotTypPtClass. - The counter is decremented when the pointer is destroyed, - be deleted when there is more pointers. - - - In the case of robots, Daniel creates an instance of class "Object" - and can return pointers to this proceeding by routines such FindRobot () - - Object FindRobot (int n) {} - - pResult in this case is a pointer CBotTypPtClass - when he found the robot concerned, it must make - - pResult-> SetPointeur (InstanceDeLaClassObject); - - this operation increments the reference - - - - - when the robot is destroyed, the instance of the Object class corresponding - is also destroyed. - if there are pointers to that object, and we planted the risk - - Solution 1: - not keep the pointer to the object directly, but - an index into a table of pointers - - Solution 2: - not destroy the object when there imédiatement pointers - but marked as virtually destroyed - - diff --git a/test/cbot/scenarios/B.txt b/test/cbot/scenarios/B.txt deleted file mode 100644 index 53715f8a..00000000 --- a/test/cbot/scenarios/B.txt +++ /dev/null @@ -1,18 +0,0 @@ - - float [ ] TEST2 ( int [ ] param ) - { - float [ ] z; - for ( int i = 0 ; i < sizeof( param ) ; i++ ) try { z [i] = param [i] / 3; } - return z; - } - -extern public void T() -{ - int a [4]; - for ( int i = 0 ; i < 3 ; i++ ) a[i] = 4*i; - a [2] = 22; - - float [] b ; - b = TEST2 ( a ) ; - show ( a, b ); -} diff --git a/test/cbot/scenarios/BUG2.txt b/test/cbot/scenarios/BUG2.txt deleted file mode 100644 index 44de05a3..00000000 --- a/test/cbot/scenarios/BUG2.txt +++ /dev/null @@ -1,107 +0,0 @@ -object object :: TT ( int n ) -{ - object XX = radar(); - if ( n == 0 ) return null; - - while ( null == XX ) XX = radar(); - return XX; -} - -extern void object::Attack( ) -{ - show ( TT ( 0 ) ) ; - show ( TT ( 1 ) ) ; - return; - - int list[]; - int i; - object p; - float dist, prox; - point dest; - boolean advance = true; - - TEST(0); // ne stoppe pas si erreur -// while ( F () != 0 ) F(1); - - i = 0; - list[i++] = WingedGrabber; - list[i++] = TrackedGrabber; - list[i++] = WheeledGrabber; - list[i++] = LeggedGrabber; - list[i++] = WingedShooter; - list[i++] = TrackedShooter; - list[i++] = WheeledShooter; - list[i++] = LeggedShooter; - list[i++] = WingedOrgaShooter; - list[i++] = TrackedOrgaShooter; - list[i++] = WheeledOrgaShooter; - list[i++] = LeggedOrgaShooter; - list[i++] = WingedSniffer; - list[i++] = TrackedSniffer; - list[i++] = WheeledSniffer; - list[i++] = LeggedSniffer; - list[i++] = Thumper; - list[i++] = PhazerShooter; - list[i++] = Recycler; - list[i++] = Shielder; - list[i++] = Subber; - list[i++] = Me; - list[i++] = 3333; - list[i++] = 3334; - list[i++] = 3335; - list[i++] = 3336; - list[i++] = 3337; - list[i++] = 3338; - list[i++] = 3339; - list[i++] = 3331; - list[i++] = 3332; - list[i++] = 3330; - list[i++] = 1111; - list[i++] = 1112; - - F(F(0)); - - while ( true ) - { - p = radar(list, 0, 360, 0, 1000); - if ( p == null ) - { - F(2); - } - else - { - dist = F(p.position, position); - if ( dist <= 40 && !advance ) - { - fire(p.position); - advance = true; - } - else - { -//? if ( RetBaseDistance() > 20 ) - { - prox = dist-(5+F()*5); - if ( prox < 5 ) prox = 5; - dest.x = (position.x-p.position.x)*prox/dist + p.position.x; - dest.y = (position.y-p.position.y)*prox/dist + p.position.y; - dest.z = (position.z-p.position.z)*prox/dist + p.position.z; - goto(dest); - advance = false; - } - } - } - } -} - -// Calcule la distance jusqu'à la base. - -float object::RetBaseDistance() -{ - object p; - float dist; - - p = radar(4444, 0, 360, 0, 1000); - if ( p == null ) return 1000; - dist = F(p.position, position); - return dist; -} \ No newline at end of file diff --git a/test/cbot/scenarios/Deleted.txt b/test/cbot/scenarios/Deleted.txt deleted file mode 100644 index 469a624c..00000000 --- a/test/cbot/scenarios/Deleted.txt +++ /dev/null @@ -1,23 +0,0 @@ -public extern void object :: ESSAI() -{ - while(true) - { - if ( true ) - { - goto(12); - break; - } - } - object x = null ; - - while ( x == null ) x = radar(); - - show ( x.position ) ; - - TEST(5, x); - - if ( x == null ) show ( "DELETED" ); - - show ( x.position ) ; - -} \ No newline at end of file diff --git a/test/cbot/scenarios/MaClass.txt b/test/cbot/scenarios/MaClass.txt deleted file mode 100644 index ac472b49..00000000 --- a/test/cbot/scenarios/MaClass.txt +++ /dev/null @@ -1,16 +0,0 @@ - -class MaClass -{ - int a = 1 ; - MaClass pointeur ; - MaClass next = null ; - CPoint autre = new CPoint( 1 , 1 ) ; -} - -extern public void Test ( ) -{ - MaClass x () ; - x.next = new MaClass ( ) ; - println ( x ) ; -} - diff --git a/test/cbot/scenarios/Mc2.txt b/test/cbot/scenarios/Mc2.txt deleted file mode 100644 index 172c259f..00000000 --- a/test/cbot/scenarios/Mc2.txt +++ /dev/null @@ -1,4 +0,0 @@ -class MaClass -{ - int t = 12; -} diff --git a/test/cbot/scenarios/Mon fichier.txt b/test/cbot/scenarios/Mon fichier.txt deleted file mode 100644 index 6b35bf83..00000000 --- a/test/cbot/scenarios/Mon fichier.txt +++ /dev/null @@ -1,2 +0,0 @@ -Voici encore du texte -et une seconde ligne diff --git a/test/cbot/scenarios/Nop.txt b/test/cbot/scenarios/Nop.txt deleted file mode 100644 index 6a66f6f1..00000000 --- a/test/cbot/scenarios/Nop.txt +++ /dev/null @@ -1,4 +0,0 @@ -public extern void Nop() -{ - while ( true ) {} -} \ No newline at end of file diff --git a/test/cbot/scenarios/POS.txt b/test/cbot/scenarios/POS.txt deleted file mode 100644 index 688e4fbc..00000000 --- a/test/cbot/scenarios/POS.txt +++ /dev/null @@ -1,14 +0,0 @@ -void object :: T ( ) -{ - show ( position ) ; -} - -public extern void object :: POS() -{ - for ( int i = 0; i < 10 ; i++ ) - { - if ( i == 2 ) TEST ( 12 ) ; -// show ( position ); - T ( ) ; - } -} \ No newline at end of file diff --git a/test/cbot/scenarios/T.txt b/test/cbot/scenarios/T.txt deleted file mode 100644 index 50a792b4..00000000 --- a/test/cbot/scenarios/T.txt +++ /dev/null @@ -1,4 +0,0 @@ -public extern int T ( float n ) -{ - return n * 1.1; -} \ No newline at end of file diff --git a/test/cbot/scenarios/TESTALL.txt b/test/cbot/scenarios/TESTALL.txt deleted file mode 100644 index 82247a0f..00000000 --- a/test/cbot/scenarios/TESTALL.txt +++ /dev/null @@ -1,161 +0,0 @@ -int T ( int z ) -{ - return 45 + z ; -} - -class toto -{ - int val = 3 ; - int x = 3 * 3 ; - void toto( int n ) - { val = n + 3 ; } - int retval ( int param ) - { int r = val + param + x ; - val = param ; - return r ; } -} - -public extern void object :: Chose( ) -{ - int z [ 6 ]; - for ( int i = 0 ; i < 6 ; ) z [ i++ ] = 3 - i ; - show ( z ) ; - return; - - // test des tableaux - int [ ] a [ 3 ] ; -// a = null; - if ( a == null ) show ( "NULL" ); - - a [ 2 / 2 ] [ 2 ]= 5 ; - int [ ] b ; b = a [1] ; - b [ 0 ] = -4; - a [ 4 / 2 ] [ 1 ]= 1 ; - show ( a , b ) ; - return ; - { - toto chose = new toto (5 ) ; - toto truc = chose ; - show ( chose, chose.retval( 100 ) , - truc, truc.retval (40 ) ) ; - - return; - } - { - point A = new - point ( 4 * 4 , 2 ) ; - show ( A ) ; - return; - } - { - show ( T ( 1 ) , T ( 3.7 ) ) ; - return; - } - - { - point A ( 3, 4 ) , - B = A ; - - int n = -4; - show ( n ); - - show ( A, B ) ; - - boolean a = false; - boolean b = a or true; - if ( not a and b ) ; - return; - } - { - // test try - float x = nan ; int z = 0 ; - try { -// throw ( 3 * 4 + 33 ) ; - int zz ; goto ( 12 ) ; z = 1 ; z = 0 / 0 ; z = 2 ; - } - catch ( 45 + 0 * 6000 ) - { - show( "Exception 6000", z ) ; - } - catch ( x == 0 ) { show( "x nul" ) ; } - finally { show ( "fini" ) ; } - show ( "continue" ); - return; - } - { - // test des if - int a = 3; - if ( a == 3 ) show ( "33"); - else show ( "44"); - if ( a != 3 ) show ( "333"); - else show ( "444"); - return; - } - { - int a = 0; - // test break -un: - while ( true ) - { -deux: - while ( true ) - { - a++; - if ( a == 2 ) continue; - if ( a == 3 ) break deux; - show ( a ) ; - if ( a == 5 ) break un; - } - show ( "DEUX" ); - } - return; - } - { - // test switch - int a = 0; - - switch ( a ) - { - case 1 : show( "un" ) ; break; - case 2 : show( "deux" ) ; // break; - case 3 : show( "trois" ) ; break; - case 4 : show( "quatre" ) ; // break; - default : show( "par défaut" ) ; - } - return; - } - { - // test boucle while - float z = 3.3; - while ( z > 0 ) - { show ( z-- ) ; } - return; - } - - { - // test boucle do - float y = 3.3; - do { int x = 0; show(y); y++; } while ( y < 7 ) ; - return; - } - // test boucle for - int j = -7; show ( j ); - for ( int ii = 3, j = 31; ii < 6 ; ++ii, j = j -3 ) - { - j = 10 * j; - show ( ii, j ); - } - return; -{ - // déclarations de variables - int a; int b = 3; int c = 4*b, d = 1, e; - float x; float y = 3.3; float z = y / 2, u = 1, v; - boolean t; boolean tt = true or false; boolean ttt = false, tttt = true, t5; - string s; string ss = "hello"; string s2 = ss + " plus", s3 = "s3", s4; - - show( b, c, d ); - show( y, z, u ); - show( tt, ttt, tttt ); - show( ss, s2, s3 ); -} -} \ No newline at end of file diff --git a/test/cbot/scenarios/TestCB1.txt b/test/cbot/scenarios/TestCB1.txt deleted file mode 100644 index 516db47d..00000000 --- a/test/cbot/scenarios/TestCB1.txt +++ /dev/null @@ -1,18 +0,0 @@ -extern public void toto() -{ - print( "hello" ) ; - print( fac(5) ); - print( t() ) ; -} - -public int fac(int n) -{ - if ( n<2 ) return 1; - return n * fac(n-1); -} - -point t() -{ - point a(1,2); - return a; -} diff --git a/test/cbot/scenarios/TestCBot1.txt b/test/cbot/scenarios/TestCBot1.txt deleted file mode 100644 index d27b4f8a..00000000 --- a/test/cbot/scenarios/TestCBot1.txt +++ /dev/null @@ -1,27 +0,0 @@ - -class CPoint2 -{ - float x, y; - void CPoint2(float x, float y) - { - this.x = x; - this.y = y; - } -} - -public extern void T ( ) -{ - CPoint2 X( 12, 33 ), Y ( -4, 4/3 ); - print ( X, Y ) ; -} - -public extern void Hello ( ) - -{ - println ( "Hello" ); -} - -public extern void test ( int n ) -{ - for ( int i = n; i>0 ; i--) print (i); -} \ No newline at end of file diff --git a/test/cbot/scenarios/TestCBot3.txt b/test/cbot/scenarios/TestCBot3.txt deleted file mode 100644 index b915f967..00000000 --- a/test/cbot/scenarios/TestCBot3.txt +++ /dev/null @@ -1,24 +0,0 @@ -public extern void Test () -{ - for ( int x = 100000; x>0 ; x-- ) { } -} - -float MaRoutine( CPoint A, CPoint B ) -{ - A.x -= B.x ; // distance en x - A.y -= B.y ; // distance en y - A.x *= A.x; // carré de la distance - A.y += A.y; // carré de la distance - println ( A, B ) ; - return ( A.x + A.y ) ; -} - -public extern void TestAB ( ) -{ - CPoint A(3, 5) ; - CPoint B(4, -2); - println ( A, B ) ; - MaRoutine( A, B ) ; - println ( A, B ) ; -} - diff --git a/test/cbot/scenarios/TestNull.txt b/test/cbot/scenarios/TestNull.txt deleted file mode 100644 index f447245f..00000000 --- a/test/cbot/scenarios/TestNull.txt +++ /dev/null @@ -1,15 +0,0 @@ -extern public void TestNull () -{ - CPoint pointeur = null; - - try { - pointeur.x = 4; } - catch ( 6007 ) {} - - pointeur = new CPoint(1,2); - - print ( pointeur.x, pointeur.y, - pointeur ); - - pointeur.x = 5; -} \ No newline at end of file diff --git a/test/cbot/scenarios/TestRestoreState.txt b/test/cbot/scenarios/TestRestoreState.txt deleted file mode 100644 index 1e49e378..00000000 --- a/test/cbot/scenarios/TestRestoreState.txt +++ /dev/null @@ -1,67 +0,0 @@ -// routine de Daniel qui plante après RestoreState - -extern void object::Attack( ) -{ - int list[], i; - object p; - float dist, prox; - point nav1, nav2, dest; - boolean advance = true; - - i = 0; - list[i++] = WingedGrabber; - list[i++] = TrackedGrabber; - list[i++] = WheeledGrabber; - list[i++] = LeggedGrabber; - list[i++] = WingedShooter; - list[i++] = TrackedShooter; - list[i++] = WheeledShooter; - list[i++] = LeggedShooter; - list[i++] = WingedOrgaShooter; - list[i++] = TrackedOrgaShooter; - list[i++] = WheeledOrgaShooter; - list[i++] = LeggedOrgaShooter; - list[i++] = WingedSniffer; - list[i++] = TrackedSniffer; - list[i++] = WheeledSniffer; - list[i++] = LeggedSniffer; - list[i++] = Thumper; - list[i++] = PhazerShooter; - list[i++] = Recycler; - list[i++] = Shielder; - list[i++] = Subber; - list[i++] = Me; - - nav1.x = 1;//cmdline(0); - nav1.y = 1;//cmdline(1); - nav2.x = 2;//cmdline(2); - nav2.y = 2;//cmdline(3); - - while ( true ) - { - while ( true ) - { - // ennemi à proximité ? - p = radar(list, 0, 360, 0, 40); - if ( p == null ) break; - // lui tire dessus - fire(p.position); - } - - // se promène vers le point A - goto(nav1); - - while ( true ) - { - // ennemi à proximité ? - p = radar(list, 0, 360, 0, 40); - if ( p == null ) break; - // lui tire dessus - fire(p.position); - } - - // se promène vers le point B - goto(nav2); - } -} - diff --git a/test/cbot/scenarios/TestStatic.txt b/test/cbot/scenarios/TestStatic.txt deleted file mode 100644 index f501aa55..00000000 --- a/test/cbot/scenarios/TestStatic.txt +++ /dev/null @@ -1,31 +0,0 @@ -class ESSAI -{ - int x = 0; - static int nb = 3; - static int [ ] array ; - - void Put( int val) - { -show(nb); - array[ nb ] = val; -// this.nb++; - this.nb = this.nb + 1; -show(nb, array); - } - int Get( ) - { - nb--; -show("out", nb, array); - return array[ nb ] ; - } -} - -extern public void T() -{ - ESSAI t1 ( ) ; - ESSAI t2 ( ) ; - t1.nb++; - t1.Put( 11 ); t1.Put( 12 ); t2.Put( 13 ); - - show ( t1.Get(), t2.Get(), t2.Get() ) ; -} \ No newline at end of file diff --git a/test/cbot/scenarios/TestStr.txt b/test/cbot/scenarios/TestStr.txt deleted file mode 100644 index 683ec1bd..00000000 --- a/test/cbot/scenarios/TestStr.txt +++ /dev/null @@ -1,17 +0,0 @@ -extern public void TSTR() -{ - string s = "C'est un essai"; - - print ( s, strlen(s), strleft(s, 3), strright(s,3), strmid(s, 2), strmid(s,2,3), strfind(s, "un"), strfind(s, "sdgfld") ); - - show ( strupper(s), strlower(s) ); - - s = "123.45" ; - print ( strval(s) ); - - - string sub = strright("abcdef", 2); // sub vaut "ef###", # étant un caractère bizarre quelconque - show (sub); - int pos = strfind("abcdef", "xy"); // pos vaut -1. Pourquoi pas nan ? - show(pos); -} diff --git a/test/cbot/scenarios/Z.txt b/test/cbot/scenarios/Z.txt deleted file mode 100644 index 714119b9..00000000 --- a/test/cbot/scenarios/Z.txt +++ /dev/null @@ -1,14 +0,0 @@ -public extern void tp() -{ - int a [4], b[]; - a [ 0 ] = 8 ; - - b = T ( a ) ; - show ( a, b ); -} - -int[] T ( int[] Z ) -{ - for ( int i = 0; i < 4 ; i++ ) Z[ i ] = i * i ; - return Z; -} \ No newline at end of file diff --git a/test/cbot/scenarios/a.txt b/test/cbot/scenarios/a.txt deleted file mode 100644 index 6107342b..00000000 --- a/test/cbot/scenarios/a.txt +++ /dev/null @@ -1,312 +0,0 @@ -object radarGuepe(point orig, float dist) -{ - int i; - object pr, r; - float mindist; - - i = 0; - mindist = 1000; - while (i<30) - { - pr = radar(i); - if (pr != null) - { - - if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) - { - mindist = distance(orig, pr.position); - r = pr; - } - } - i = i+1; - } - if (mindist < dist) return(r); else return(null); -} - - -class Guepe -{ - - point pos; - - - void cherche(point orig, float dist) - { - object p; - point o; - - p = radarGuepe(orig, dist); - while (p == null) - { - wait(0.1); - p = radarGuepe(orig, dist); - } - - pos.x = p.position.x; - pos.y = p.position.y; - pos.z = p.position.z; - - //o = p.position; - //wait(0.1); - - //vitessex = (p.position.x - o.x)/0.1; - //vitessey = (p.position.y - o.y)/0.1; - //vitessez = (p.position.z - o.z)/0.1; - - } - - - void tire(point orig, float orient) - { - //float t = 3; //temps d'anticipation - float angle; - point cible; - - cible.x = pos.x;// + t*vitessex; - cible.y = pos.y;// + t*vitessey; - cible.z = pos.z;// + t*vitessez; - - if (cible.x == 0) angle = 90; else - angle = atan(cible.y / cible.x); - if (cible.x < 0) angle = angle + 180; - angle = angle - orient; - if (angle > 180) angle = angle - 360; - if (angle < -180) angle = angle + 360; - turn(angle); - - angle = atan((cible.z-orig.z) / distance2d(orig, cible)); - aim(angle); - - fire(0.1); - - } -} - -extern void object::Fourmi6() -{ - //fps(1000); - Guepe guepe = new Guepe(); - - while (true) - { - guepe.cherche(position, 50); - - guepe.tire(position, orientation); - } -} -object radarGuepe(point orig, float dist) -{ - int i; - object pr, r; - float mindist; - - i = 0; - mindist = 1000; - while (i<30) - { - pr = radar(i); - if (pr != null) - { - - if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) - { - mindist = distance(orig, pr.position); - r = pr; - } - } - i = i+1; - } - if (mindist < dist) return(r); else return(null); -} - - -class Guepe -{ - - point pos; - - - void cherche(point orig, float dist) - { - object p; - point o; - - p = radarGuepe(orig, dist); - while (p == null) - { - wait(0.1); - p = radarGuepe(orig, dist); - } - - pos.x = p.position.x; - pos.y = p.position.y; - pos.z = p.position.z; - - //o = p.position; - //wait(0.1); - - //vitessex = (p.position.x - o.x)/0.1; - //vitessey = (p.position.y - o.y)/0.1; - //vitessez = (p.position.z - o.z)/0.1; - - } - - - void tire(point orig, float orient) - { - //float t = 3; //temps d'anticipation - float angle; - point cible; - - cible.x = pos.x;// + t*vitessex; - cible.y = pos.y;// + t*vitessey; - cible.z = pos.z;// + t*vitessez; - - if (cible.x == 0) angle = 90; else - angle = atan(cible.y / cible.x); - if (cible.x < 0) angle = angle + 180; - angle = angle - orient; - if (angle > 180) angle = angle - 360; - if (angle < -180) angle = angle + 360; - turn(angle); - - angle = atan((cible.z-orig.z) / distance2d(orig, cible)); - aim(angle); - - fire(0.1); - - } -} - -extern void object::Fourmi6() -{ - //fps(1000); - Guepe guepe = new Guepe(); - - while (true) - { - guepe.cherche(position, 50); - - guepe.tire(position, orientation); - } -} -object radarGuepe(point orig, float dist) -{ - int i; - object pr, r; - float mindist; - - i = 0; - mindist = 1000; - while (i<30) - { - pr = radar(i); - if (pr != null) - { - - if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) - { - mindist = distance(orig, pr.position); - r = pr; - } - } - i = i+1; - } - if (mindist < dist) return(r); else return(null); -} - - -class Guepe -{ - - point pos; - - - void cherche(point orig, float dist) - { - object p; - point o; - - p = radarGuepe(orig, dist); - while (p == null) - { - wait(0.1); - p = radarGuepe(orig, dist); - } - - pos.x = p.position.x; - pos.y = p.position.y; - pos.z = p.position.z; - - //o = p.position; - //wait(0.1); - - //vitessex = (p.position.x - o.x)/0.1; - //vitessey = (p.position.y - o.y)/0.1; - //vitessez = (p.position.z - o.z)/0.1; - - } - - - void tire(point orig, float orient) - { - //float t = 3; //temps d'anticipation - float angle; - point cible; - - cible.x = pos.x;// + t*vitessex; - cible.y = pos.y;// + t*vitessey; - cible.z = pos.z;// + t*vitessez; - - if (cible.x == 0) angle = 90; else - angle = atan(cible.y / cible.x); - if (cible.x < 0) angle = angle + 180; - angle = angle - orient; - if (angle > 180) angle = angle - 360; - if (angle < -180) angle = angle + 360; - turn(angle); - - angle = atan((cible.z-orig.z) / distance2d(orig, cible)); - aim(angle); - - fire(0.1); - - } -} - -extern void object::Fourmi6() -{ - //fps(1000); - Guepe guepe = new Guepe(); - - while (true) - { - guepe.cherche(position, 50); - - guepe.tire(position, orientation); - } -} - -public extern void TestTableau () -{ - int tableau [ 12 ] ; - - point array[ 12 ] [ 14 ] ; - - point zéro ( 1, 2 ) ; - point a = zéro ; - - for ( int i = 0 ; i < 10 ; i++ ) array[ i ] [ i ]= zéro ; - - array[ 5 ] [3 ] . x =1.5 ; - - array[ 2 ] [ 2 ] . y = array[ 5 ] [ 5 ] . x ; - - array[ 4 ] = array [ 2 ] ; - - for ( int i = 0 ; i < 10 ; i++ ) for ( int j = 0 ; j < 4 ; j++ ) println ( i, j, array [ i ] [ j ] ) ; - - show( zéro, a, array ); - -} - diff --git a/test/cbot/scenarios/bug.txt b/test/cbot/scenarios/bug.txt deleted file mode 100644 index 4ec6eb38..00000000 --- a/test/cbot/scenarios/bug.txt +++ /dev/null @@ -1,12 +0,0 @@ -public extern void object::Bug() -{ - point a; - a = position; - TEST(); - float d=dist(a, position); -} - -float dist(point a, point b) -{ - return a.x-b.x; -} diff --git a/test/cbot/scenarios/bugmw.txt b/test/cbot/scenarios/bugmw.txt deleted file mode 100644 index 284ee43f..00000000 --- a/test/cbot/scenarios/bugmw.txt +++ /dev/null @@ -1,9 +0,0 @@ -extern public void main() -{ - show(fact(30)) ; -} - -public int fact(int n) -{ - return (fact(n-1)*n) ; -} diff --git a/test/cbot/scenarios/ccc.txt b/test/cbot/scenarios/ccc.txt deleted file mode 100644 index dbcd1d5d..00000000 --- a/test/cbot/scenarios/ccc.txt +++ /dev/null @@ -1,8 +0,0 @@ -public extern void ccc() -{ - int a; - a = 0 ; - - if ( a == 0 ); - -} \ No newline at end of file diff --git a/test/cbot/scenarios/enum.txt b/test/cbot/scenarios/enum.txt deleted file mode 100644 index a592a7fb..00000000 --- a/test/cbot/scenarios/enum.txt +++ /dev/null @@ -1,9 +0,0 @@ - -enum JourDeLaSemaine { - lundi = 1, - mardi, - mercredi, - jeudi, - vendredi, - samedi, - dimanche = 0 } \ No newline at end of file diff --git a/test/cbot/scenarios/fibo.txt b/test/cbot/scenarios/fibo.txt deleted file mode 100644 index 88f53579..00000000 --- a/test/cbot/scenarios/fibo.txt +++ /dev/null @@ -1,25 +0,0 @@ - -extern public int Fibo( int n, boolean b ) -{ - if ( n < 2 ) return n; - int a = Fibo(n-1, b) + Fibo(n-2, false); - if ( b ) print (n + "=" + a); - return a; -} - -extern public void t() -{ - Fibo( 23, true); -} - -extern public void tt() -{ - t(); -} - -// cette routine n'est évidemment pas du tout obtimisée -// c'est même un très mauvais exemple de programmation récursive - -// pour un test de durée, Fibo(23, true) prend -// en mode Debug 67 secondes -// en mode Release 8 secondes diff --git a/test/cbot/scenarios/file.txt b/test/cbot/scenarios/file.txt deleted file mode 100644 index 2a22dd96..00000000 --- a/test/cbot/scenarios/file.txt +++ /dev/null @@ -1,70 +0,0 @@ -class CLASS22 -{ - static int nb = 2; - void T22 ( ) { nb = nb / 0 ; } -} - -public extern void object :: TEST() -{ - switch ( 1 ) - { - case 1: - { - file h(); - h.open("Mon Fichier.txt", "r"); -show ( h.filename, h.handle ); -h.filename = "xx"; -h.handle = 1 ; - h.readln(); - h.close(); - } - case 2: - { - file h("Mon Fichier.txt"); - h.open("r"); - h.readln(); - h.close(); - } - case 3: - { - file h("Mon Fichier.txt", "r"); - h.readln(); - h.close(); - } - case 4: - { - file h(); - h.filename = "Mon Fichier.txt"; - h.open("r"); - h.readln(); - h.close(); - } - case 5: - { - file h = fileopen( "Mon 2Fichier.txt", "r" ); - h.readln(); - h.close(); - } - } -{ - file h( ) ; - h.filename = "Test.h"; - h.open ( "r" ); - - - file pf ( "Mon Fichier.txt" ) ; - pf . open ( "w" ) ; - pf . writeln ( "Voici encore du texte" ) ; - pf . writeln ( "et une seconde ligne" ) ; - pf . close( ); - - pf . open ( "r" ) ; - - while ( not pf . eof( ) ) - { - string s = pf . readln ( ); - show ( s ); - } - pf.close( ); -} -} diff --git a/test/cbot/scenarios/h.txt b/test/cbot/scenarios/h.txt deleted file mode 100644 index c3953199..00000000 --- a/test/cbot/scenarios/h.txt +++ /dev/null @@ -1,5 +0,0 @@ -void tf() -{ - file h; - h.handle += 1 ; -} \ No newline at end of file diff --git a/test/cbot/scenarios/include.txt b/test/cbot/scenarios/include.txt deleted file mode 100644 index e8f8cc97..00000000 --- a/test/cbot/scenarios/include.txt +++ /dev/null @@ -1,27 +0,0 @@ -class Z -{ - static int x = 0; - private int y; - - void T( ) - { - // autorisé ici - y = x ; - this.y = this.x ; - x = y ; - this.x = this.y ; - } -} - -extern public void test() -{ - Z a(); - 3 * a.x; // autorisé -//vu 3 * a.y; // interdit -//vu a.y = 3; // interdit ici - a.x = 1; // autorisé - - show ( a ); - a.T(); - show ( a ); -} diff --git a/test/cbot/scenarios/intrinsic.txt b/test/cbot/scenarios/intrinsic.txt deleted file mode 100644 index f2157914..00000000 --- a/test/cbot/scenarios/intrinsic.txt +++ /dev/null @@ -1,16 +0,0 @@ -public extern void TestIntrinsic() -{ - point a ( 1, 2 ); - print (a); - - a.x = 3; - a.y = 4; - - point b = a; - - println ( b.x, b.y, b ) ; - if ( b == a ) b.y = 0; - println (a,b); - if ( b != a ) b.y = a.y; - println(a,b); -} \ No newline at end of file diff --git a/test/cbot/scenarios/methode1.txt b/test/cbot/scenarios/methode1.txt deleted file mode 100644 index 080bba29..00000000 --- a/test/cbot/scenarios/methode1.txt +++ /dev/null @@ -1,57 +0,0 @@ -class t { - point p; -} - -void object :: toto() -{ - show ( Position ) ; -} - -extern public void object :: XX() -{ - int test []; - test [ 9999 ] = 3; - - toto () ; -/* - Radar(); - - object test ; - test = this. Radar(); - - do { - test = this.Radar(); - } while ( test == null ); - -/* - t test [ 4 ]; - for ( int i = 0 ; i < 4 ; i++ ) test [ i ] = new t(); - test [ 3 ] .p.x = 2; - show ( test ); -/* - int a = nan; - show ( a ) ; - - a = TypeMarkPath; - show ( a, a++, --a ) ; - - if ( a != nan ) a += 1 ; - - a = TypeMarkPath; - float q = a ; - show ( a, q ) ; - -return; - - a += ++a; - show ( a ) ; - - boolean i = false; - - if ( i == true ) {} - - object p; - if ( p == null) { p = p ; } -*/ -} - diff --git a/test/cbot/scenarios/methode2.txt b/test/cbot/scenarios/methode2.txt deleted file mode 100644 index 76ce7f48..00000000 --- a/test/cbot/scenarios/methode2.txt +++ /dev/null @@ -1,50 +0,0 @@ - -extern void Toto() -{ - TEST(12); - - for ( int i = 0 ; i<1000; i++) - { - int j = 1; - if (i==55) TEST(12); - } - - TEST(2); - - -// Nouveau(); - int toto[4]; - point Z[3]; - - Z[1].x = 11; Z[1].y = 12; - - toto[2] = 12; - toto[1] = nan; - -// point test, autre(2,3) ; -// object titi = Radar(); - - TEST ( 1 ) ; - - toto[0] = 11; - - TEST ( 2 ) ; - - toto[6] = 0; -} - -extern void object::Nouveau() -{ - point a; - a = np(Position); -} - -point np(point b) -{ - point c; - c.x = b.y; - c.y = b.x; - return c ; -} - - diff --git a/test/cbot/scenarios/mp1.txt b/test/cbot/scenarios/mp1.txt deleted file mode 100644 index 599cfc46..00000000 --- a/test/cbot/scenarios/mp1.txt +++ /dev/null @@ -1,25 +0,0 @@ -class Guepet -{ - - float a; - float b; - - void init() - { - a = 12.34; - b = 56.78; - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe =new Guepet(); - - guepe.init(); - - - show("test "+guepe.a+" "+guepe.b); - -} diff --git a/test/cbot/scenarios/mp2.txt b/test/cbot/scenarios/mp2.txt deleted file mode 100644 index 1c2972c9..00000000 --- a/test/cbot/scenarios/mp2.txt +++ /dev/null @@ -1,28 +0,0 @@ -class Guepet -{ - - float a; - float b; - - void init() - { - a = 12.34; - b = 56.78; - - object x = radar(123); - show("radar "+x.position.x); - show("C'est fait"); - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe=new Guepet(); - - guepe.init(); - - show("test "+guepe.a+" "+guepe.b); - -} diff --git a/test/cbot/scenarios/mw.txt b/test/cbot/scenarios/mw.txt deleted file mode 100644 index c2376707..00000000 --- a/test/cbot/scenarios/mw.txt +++ /dev/null @@ -1,16 +0,0 @@ -extern public void main() -{ -// goto( 3, 4 ); - - while( true ) - { - try { goto (12) ; } - catch( FF( ) ) - { show( "ko"); } - } -} - -boolean FF() -{ - return false; -} diff --git a/test/cbot/scenarios/null.txt b/test/cbot/scenarios/null.txt deleted file mode 100644 index ae76b742..00000000 --- a/test/cbot/scenarios/null.txt +++ /dev/null @@ -1,5 +0,0 @@ -extern public void xxx () -{ - CPoint test = null ; - if ( test == null ) show ( "NULL" ); -} \ No newline at end of file diff --git a/test/cbot/scenarios/opnew.txt b/test/cbot/scenarios/opnew.txt deleted file mode 100644 index 7d6838c2..00000000 --- a/test/cbot/scenarios/opnew.txt +++ /dev/null @@ -1,20 +0,0 @@ -extern public void xx () -{ - CPoint pointeur, test = null ; - pointeur = new CPoint ( 3, 4 ); - - if ( test == null ) show ( "NULL" ); - - CPoint pp = pointeur; - -show( pointeur , pp ); - - pp.x = 33.3; - if ( pointeur.x != pp.x ) 0/0; - - pp = new CPoint(); -// pointeur = pp; - -show( pointeur , pp ); - -} \ No newline at end of file diff --git a/test/cbot/scenarios/plante.txt b/test/cbot/scenarios/plante.txt deleted file mode 100644 index 363461b1..00000000 --- a/test/cbot/scenarios/plante.txt +++ /dev/null @@ -1,25 +0,0 @@ -class Guepet -{ - - point pos; - float t = 0.1; - - void init() - { - pos.x = 12.123; - pos.y = 34.345; - - F(t); - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe=new Guepet(); - - guepe.init(); - - show ( guepe ); -} diff --git a/test/cbot/scenarios/pointer.txt b/test/cbot/scenarios/pointer.txt deleted file mode 100644 index 2d4d907a..00000000 --- a/test/cbot/scenarios/pointer.txt +++ /dev/null @@ -1,41 +0,0 @@ -extern public void x () -{ - show ( 3 ** 4 ); - float z = 1e-3; - show ( z ); - - CPoint b ( 4,5 ); - show ( b ); - - CPoint a ( ) ; - a.x = 21; a.y = 12; - show ( a ) ; - - CPoint test = new CPoint ( 1,1 ); - test = new CPoint ( 2, 2 ); - show ( test ); -} - -// crée un objet et retourne son pointeur -CPoint newcpoint() -{ - CPoint p = new CPoint ( 3, 3 ); - return p; -} - -extern public void y () -{ - CPoint test = newcpoint(); - println ( test ); - dontmodif( test ); - println ( test ); -} - -// ne doit pas modifier l'objet en paramètre -void dontmodif ( CPoint pp ) -{ - pp.x = 5; - pp.y = 2; - println ( pp, pp.x, pp.y ); -} - diff --git a/test/cbot/scenarios/postinc.txt b/test/cbot/scenarios/postinc.txt deleted file mode 100644 index cdf6ab5b..00000000 --- a/test/cbot/scenarios/postinc.txt +++ /dev/null @@ -1,7 +0,0 @@ -extern public void X() -{ - point A [ ] ; - A[5] = new point (2,3); - int val = A[5].x++ + --A[5].y; - show ( A, val ); -} diff --git a/test/cbot/scenarios/radar.txt b/test/cbot/scenarios/radar.txt deleted file mode 100644 index 09d84a27..00000000 --- a/test/cbot/scenarios/radar.txt +++ /dev/null @@ -1,39 +0,0 @@ -extern void object::Bug( ) -{ - try{ int a = 44 ; a = 12 / 0 ; } - catch(6000) { int b = 4 ; } - finally { int z = 1 ; } - -// tp ( A, B ); - -/* int a = 4, b = 2, c = nan; - float x, y = 3/2, z = nan; - boolean i, j = false, k = true; - - string s, ss = "xyz"; - - while ( false ) - { - object left, right; - - left = Radar(TypeMarkPath, -45, 120, 100); - right = Radar(TypeMarkPath, 45, 120, 100); - - if ( left == null && right == null ) - { - } - } - int t = fact ( 4 ) ;*/ -} - -void tp( point a , point b ) -{ - a.x += b.x; -} - - -int fact( int n ) -{ - if ( n < 2 ) return n; - return n * fact ( n - 1 ) ; -} \ No newline at end of file diff --git a/test/cbot/scenarios/solution.txt b/test/cbot/scenarios/solution.txt deleted file mode 100644 index f78cf12e..00000000 --- a/test/cbot/scenarios/solution.txt +++ /dev/null @@ -1,13 +0,0 @@ -extern void object::Solution( ) -{ -show ( "Solution " + Position ); - Carré(15); - Carré(25); -} - -void object::Carré(float côté) -{ -show ( "Carré " + Position ); - Move(côté); - Turn(-90); -} \ No newline at end of file diff --git a/test/cbot/scenarios/test.txt b/test/cbot/scenarios/test.txt deleted file mode 100644 index 0693994e..00000000 --- a/test/cbot/scenarios/test.txt +++ /dev/null @@ -1,8 +0,0 @@ -extern public void x() -{ - float a= 1, b = 2; - a = b * ( 2 + 2 ); - print (a); - a += 4; - print (a); -} diff --git a/test/cbot/scenarios/test23.txt b/test/cbot/scenarios/test23.txt deleted file mode 100644 index d6e1dddb..00000000 --- a/test/cbot/scenarios/test23.txt +++ /dev/null @@ -1,10 +0,0 @@ -extern public void object::TEST23() -{ - CLASS22 T; - T.T22( ) ; - - show( position ); - show( this.position ); - -// T22(); -} \ No newline at end of file diff --git a/test/cbot/scenarios/testmw.txt b/test/cbot/scenarios/testmw.txt deleted file mode 100644 index 6570f6d1..00000000 --- a/test/cbot/scenarios/testmw.txt +++ /dev/null @@ -1,14 +0,0 @@ -extern public int testmw( int a) -{ - boolean b = true ; - - if (b) - return 1 ; - else - return a ; 0 * testmw(a-1) ; -} - -public int Fibo2 ( int n ) -{ - print ( " bof " ); -} \ No newline at end of file diff --git a/test/cbot/scenarios/this.txt b/test/cbot/scenarios/this.txt deleted file mode 100644 index b8a9e044..00000000 --- a/test/cbot/scenarios/this.txt +++ /dev/null @@ -1,13 +0,0 @@ -extern void object :: TEST22 ( ) -{ - show( position ); - show( this.position ); - - T(); -} - -public void object :: T22() -{ - show( position ); - show( this.position ); -} \ No newline at end of file diff --git a/test/cbot/scenarios/tt.txt b/test/cbot/scenarios/tt.txt deleted file mode 100644 index cd13c9db..00000000 --- a/test/cbot/scenarios/tt.txt +++ /dev/null @@ -1,12 +0,0 @@ -extern public void T() { T1(); } - -public void T1() -{ - show( "T1" ); - T2(); -} - -public void T2() -{ - show( "T2" ); -} \ No newline at end of file diff --git a/test/cbot/scenarios/tt2.txt b/test/cbot/scenarios/tt2.txt deleted file mode 100644 index ad9dc1df..00000000 --- a/test/cbot/scenarios/tt2.txt +++ /dev/null @@ -1,5 +0,0 @@ -extern public void TT() -{ - T1(); - T2(); -} \ No newline at end of file diff --git a/test/cbot/scenarios/vide.txt b/test/cbot/scenarios/vide.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/test/cbot/scenarios/zz.txt b/test/cbot/scenarios/zz.txt deleted file mode 100644 index da764ac7..00000000 --- a/test/cbot/scenarios/zz.txt +++ /dev/null @@ -1,6 +0,0 @@ -extern public void zz() -{ - MaClass TOTO (); - - show (TOTO); -} \ No newline at end of file