Soak the noodles in warm water while you prepare the rest of the ingredients.
Using a wok or large sauté pan, heat oil over medium high heat. Add shallot, garlic, carrots and tofu. Stir fry for a few seconds until fragrant. Add the tamarind, sugar, fish sauce, soy sauce and ground chili flakes.
With your hands, pull the noodles out of the water and add to the pan. Toss noodles thoroughly with sauce mixture until tender. Taste a noodle. I f it's not tender, splash in a bit of the soaking water and cook until noodles soften.
Make a space in the middle of the pan and add the egg and more oil if needed. Scramble egg until barely set and mix in with noodles.
Add lime juice. Taste. If you feel that it needs more seasoning such as fish sauce, sugar etc. add to taste. Toss with half the bean sprouts, half the scallions and half of the peanuts.
Serve on a platter with the remaining bean sprouts, scallions, peanuts and lime wedges as garnish.