Lattice-Boltzmann and lattice-gas simulations of binary immiscible and ternary amphiphilic fluids in two and three dimensions