The NXT Duel is a game that tests your reflexes, entirely built with a NXT 2.0 kit. Play against other person, or play by yourself beating the computer challenges.

How to play

Whoever shoots first after the bell rings wins. Watch out for distractions, like the crows squawking — if you shoot too early, you’ll lose.

During the round, an orange flag will rise. Its purpose is to create tension since the bell is guaranteed to ring sometime before it fully rises.

Single player mode

In single player mode, you’ll need to beat the 9 computer challenges: after the bell rings, you must shoot within the number of milliseconds specified in the round. In the first round, you’ll have 500 ms — that’s actually plenty of time! In the last challenge, though, you’ll be at the edge of standard human reflex times 🙂

The record number of tries that you take to complete all challenges is recorded. Can you do it in only 9 rounds, without a single miss?

In this mode, use the gun with the grey handle.

Two player mode

It’s simple: whoever shoots first, wins! You can select the number of rounds you need to win in order to win the game. The response time of the round winner is shown on the screen.

Instruction and Program

First, get everything you need:

  1. Download program, source, LDD model and resources
  2. Extract the zip file (check this if you need help)

Buliding the model:

  1. If you don’t have LEGO Digital Designer, download and install it.
  2. Double click the duel.lxf file in the folder you have extracted.
  3. After the file opens in LEGO Digital Designer, press F7 and follow the instructions to build the model.

Downloading the program and files to the NXT:

  1. Turn on your NXT and connect it to your PC using the USB cable.
  2. Open the LEGO MINDSTORMS NXT sofware.
  3. Near “Create new program”, click “Go >>”.
  4. Open the NXT window (click the upper left button above the “Play” button.
  5. Click on the “memory” tab.
  6. Click “Download”. Go to folder you have extracted in Step 2, select the first file and Click OK. Click “Download” again, select the second file, click OK, and so on for all files (sorry, I don’t know any easier way to do this).
  7. In your NXT, go to “My Files”, “Software Files”, then “Duel”.
  8. Play!

The program is coded in NXC, you can use the Bricx Command Center if you want to make changes to the code.

Fun Facts About Reaction Time

There is some interesting research on reaction time; check this literature review. Some highlights:

  • Reaction time for sound stimuli is smaller than for visual stimuli; 160 ms vs 190 ms on average. (These are simple reaction times. Since there are distractions in the NXT Duel, your response time will be slower.)
  • Your reaction time get worse if you’re too relaxed or too tense.
  • Your reaction time is faster during expiration.
  • Your reaction time is faster with your left hand if you are right-handed, and vice-versa.


  1. El problema es que a la variable end_time no se suma la variable CurrentTick() si lo pones de la siguiente manera:

    long end_time = CurrentTick() + 2000 + rnd + Random(1000);

    Para solucionar el problema debemos de poner:

    long end_time;
    end_time = CurrentTick() + 2000 + rnd + Random(1000);

    1. I’m not sure what you mean, the base is somewhat flexible, but it held itself fine on a flat surface.

      Sorry for the instructions, LDD instructions are not so good. I’ll try to make my own next time.

      But I suggest that you use your creativity, the basic structure is very simple (just motors with axles attached). Most of the model is just decorations, so you can come up with your own 🙂

  2. Can you please make better instructions for this particular robot. I really want to build it but the LDD instructions are horrible. Please post this ASAP.


    1. i made one at school in robotics. it only took two hours and programing was simple. im only twelve and have only porgramed a robot to move foreward before i programed the game.

          1. I found the button and it was grayed out therefore not an option. I am not really good at this. Is the NXT the programming box?:/

    1. Click on the “Download program, source, LDD model and resources” link in the post. Extract the zip file. Install LDD. Double click the extracted lxf file.

  3. Conrado….I cannot get the flag to rotate properly. It doesnt rotate like on your video it just sits there and i have to manually push it down to get the next shot to work. Is your program faulty? can you take a look at it and let me know?

    1. Extract the zip file.
      Open the Memory tab of the NXT window (the upper left button besides the “Play” button) and click Download. Select the extracted files.

  4. I tried changing the cables and every possible combination but still the flag doesnt rotate like it is supposed to. Anyone else had this problem with the program?

    1. I’ve double checked and everything is fine. If you use batteries, are they fully recharged? Otherwise, it may be a problem in the “A” port of your NXT brick — do other programs work fine?

  5. i think you mean “download” not “upload” don’t you? upload takes programs from the nxt to the pc whereas “download” takes programs from pc and puts it onto the nxt.

    1. You can’t open the program in the NXT software since it was coded using another method. But it runs just fine. If you want to edit the code, you will need to learn NXC.

    1. The NXC compiler for the NXT, which uses (something like) the C language, uses the .nxc file extension. The source code is in the .nxc file.

  6. Wow i love the guns! there AMASING!!! how did you come up with the idear? i am going to use them in my next robot!!!! do you have any idears of how i should use them???


  7. Conrado, my son and I thank you for a super project. We really appreciate that you took the time to imagine, build, document and share your procedure. We were able to get through the building instructions and where the LDD wasn’t perfectly clear, we adjusted our design to suffice. When we wanted to change the look or details, we used our imagination and did it. Basically, I just wanted to let you know that despite some of the frustrated comments posted here, there are rational people in the world who don’t have to have every trivial thing spelled out to them. I hope you are able to look past the whining and continue to build and share. You are an inspiration to kids like my son!

    1. Hi! Thank you very much for the kind comment — it makes all worth it.

      Stay tuned, I’ll soon post another project which I think is very fun 🙂

  8. Hi! Awesome robot, but I ran into a problem, I cannot open the .nxc file in the Lego Mindstorms NXT 2.0 software. Is there another way of transferring the program into my NXT Brick or am I just doing it wrong?

    1. You’re not supposed to open the .nxc file with the NXT software. It was written using NXC; if you want to edit the program, you will need to use Bricx Command Center.

      If you just want to play it, follow the instructions — you just need to download the .rxe file and auxiliar files (i.e. all files except the .lxf and .nxc).

  9. HI really great project
    however i can’t download any of the files
    which one am i suppose to?
    can you reply to this comment with the file that im suppose to download?
    all the files says nxc rxe ric rso and when i tried to change those files to an nxt file, it says there is an error.
    what am i doing wrong?

  10. Nice project !
    everything was just fine from constructing the robot until downloading the program into my NXT.
    But problem appeared after I press the orange button to run the program, It doesn’t display anything on the screen. I mean my NXT’s screen. It is blank
    May I know what’s the problem ?

    1. Make sure you transfer all the files to the NXT:


  11. mira encontré un problema y es que cuando el jugador gris dispara la bandera no se detiene y la música deja de sonar, en pocas palabras el juego deja de funcionar y te quería pedir el favor de que me mandaras un plano de como conectar los cables, gracias

  12. where do i find the program itself? not the building instructions like the thing you put into the NXT programming program. i built my own model and i need to make it where when 1 shoots the other person cant which i cant figure out. please help

    1. The source code is the Duel.nxc file. I didn’t use the default NXT software to write it; I’ve used the Bricx Command Center using the NXC language. If you just want to read the program, you can open the Duel.nxc file in a text editor (right click, Open with…). If you want to edit the program and run it, you will need Bricx Command Center.

      1. what i mean is im not using the instructions. i made my own version of it and idk how to download your program on to mine. i just wanna know how to make it where when 1 shoots it prevents the other from shooting so i can mkae it myself. im not one to follow intruction booklets. :/

        1. You say you want to download my program, but you also say you want to prevent the other from shooting. Do you want to use my program or are you writing the program yourself?

          1. I see. I can’t give you precise instructions (and you’re not one to follow instructions), but the idea is: when a player shoots, set a variable to 1, and only allow shooting if the variable is 0. After indicating the result, set it back to 0.

  13. idk what that is. can you give me like a list of what to set. i have it set up like this.
    -Wait for touch–motor(the guy falling)–wait: 1 sec–motor: the guy getting up)–image–wait 10 secs-

    i have the image cause i have it where whoever shoots last there image will come up latest which is an arrow pointing towards the other player showing that the other player won. but when players shoot both of the guys fall down which i dont want and i dont want it to make the shooting sound

          1. ok, i got the thing. my NXT it connected to it. i opened Duel in it and well….its not as readable as i thought it would be to put into the defualt NXT programming

          2. Yes, there is a learning curve… but after you learn it you can do many stuff that would be very hard to program in the default programming language. There is a NXC manual and many tutorials around the net. 🙂

  14. ok. i think i got it all. but i cant download the program from NXC to my NXT . i pressed f7 while my NXT was on and plugged in with a USB and i made sure that the computer knows it was plugged in and yet f7 still did nothing

  15. Hello Conrado!
    First of all, congrats on the project, the design, it is really amazing. Also, lots of thanks for sharing your building instruction, code and your detailed description on everything. My friend and I made it with ease thanks to your detailed instructions.
    I do have a question for you, maybe I am blunt for asking it, but I’m gonna go with it. We wanted to play a little with the code, make some changes, but it seems like even the smallest change to it makes the project crash. Confused, we then tried testing it like renaming just a method or so, it still would crash. We then tried to just eliminate the single player mode, it crashed. I am saying all this so you know it is not that we have written a new code that doesn’t work, to make it clear what I am asking. We never coded in Bricx Command Center, so we are a little unfamiliar with it. So, we make this small changes to the code, compile it and then download it to the nxt device, and then try to run it. We did not erase any of the other files. Is it possible that somehow the NXT platform has hard-coded the previous version of the Duel.nxc?
    Sorry for the long post, but we could really use some help with this. Thanks a lot!

  16. I made this using your instructions and it works perfectly!!! Can’t wait to have a showdown in class.

    Thanks so much for making this available!

  17. Hey guys , I had a problem with the sensor / motor ports
    if you also had a problem the correct connections that worked for me are
    Right (hand side) motor : Port C
    Left (hand side) motor : Port B
    Clock : Port A
    Right (hand side) gun : Port 2
    Left (hand side) gun: Port 1

Leave a comment