(2) Both the defendant and the state may elect to waive trial by jury and consent to a trial by the judge of the court alone, provided that the election of the defendant is in writing and with the consent of the trial judge. [1973 c.836 §221; 1997 c.313 §21]