Skip to content

Commit

Permalink
Added mode and made better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stikosek committed Apr 29, 2023
1 parent f11e8c6 commit 7b55af7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@
This is a simpel brainfuck interpeter written in rust.
It has 2 modes, classic (default) and visualised.

## Usage

```sh
brainfuck-interpeter <filename> <mode>
```
You can leave out mode, it defaults to `classic`.
You can also put `visualised` there to get a live memory map and slowed down execution

## Example

![](https://stikosek.xyz/files/bfgif.gif)
13 changes: 11 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,17 @@ fn main() {

let mut program: Program = Program::build(contents);

//program.run();
program.diagnostic_run();
// Run based on mode of operation
let arguments: Vec<String> = env::args().collect();
if arguments.len() > 2 {
if arguments[2] == "visualised" {
program.diagnostic_run();
}else{
program.run();
}
}else{
program.run();
}
}

fn clear_term() {
Expand Down

0 comments on commit 7b55af7

Please sign in to comment.