Exemple #1
0
    wait: function( first ) {
        print( 'wait' );

        if ( first ) {
          Gitwar.poll( Gitfight.takeTurn );
        } else {
          Gitwar.sync()
          .then( function() {
              return Gitwar.poll( Gitfight.takeTurn );
          });
        }
    },
Exemple #2
0
        .then( function( head ) {
            if ( !Gitwar.me ) {
                print( 'userMissing' );
                process.exit();
            }

            if ( Gitfight.score.me <= 0 ) {
                print( 'theyWin' );
                process.exit();
            } else if ( Gitfight.score.opponent <= 0 ) {
                print( 'youWin' );

                if ( head.user != Gitwar.me ) {
                    Gitwar.addLog( turn )
                    .then( function() {
                        print( 'wrapUp' );

                        Gitwar.sync();
                        process.exit();
                    });
                } else {
                    print( 'wrapUp' );

                    Gitwar.sync()
                    .then( function() {
                        process.exit();
                    });
                }
            } else {
                if ( !head.user && Gitwar.users[ 0 ] == Gitwar.me || head.user == Gitwar.me ) {
                    return Gitfight.wait( true );
                } else {
                    return Gitfight.takeTurn();
                }
            }
        });
Exemple #3
0
                    .then( function() {
                        print( 'wrapUp' );

                        Gitwar.sync();
                        process.exit();
                    });
Exemple #4
0
                .then( function() {
                    print( 'wrapUp' );

                    return Gitwar.sync();
                })