fix: use usize for state number to not have to deal with size checks
This commit is contained in:
1 parent
af728ec0bb
commit
a3621f6201
1 file changed
+2
-4
+2
-4
@@ -1,9 +1,7 @@
|
|||||||
use std::{collections::HashMap, num::NonZeroU8};
|
use std::{collections::HashMap, num::NonZeroUsize};
|
||||||
|
|
||||||
use crate::tape::{Tape, TapeSymbol};
|
use crate::tape::{Tape, TapeSymbol};
|
||||||
|
|
||||||
const MAX_STATE_COUNT: u8 = 255;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct TuringMachine {
|
struct TuringMachine {
|
||||||
state_table: HashMap<(MachineState, TapeSymbol), MachineAction>,
|
state_table: HashMap<(MachineState, TapeSymbol), MachineAction>,
|
||||||
@@ -29,7 +27,7 @@ impl TuringMachine {
|
|||||||
#[derive(Eq, Hash, PartialEq)]
|
#[derive(Eq, Hash, PartialEq)]
|
||||||
enum MachineState {
|
enum MachineState {
|
||||||
Halt,
|
Halt,
|
||||||
StateNumber(NonZeroU8),
|
StateNumber(NonZeroUsize),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MachineAction {
|
struct MachineAction {
|
||||||
|
|||||||
Reference in new issue
Block a user