aboutsummaryrefslogtreecommitdiff
path: root/max2.bf
blob: f2665d47ec9ce26e0cf3faf2b5f6289428f3a509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Show the maximum number

# == Preparations ==

# input the 1st number into the 1st cell
, # |a|0|0|0|0|0|

# copy 1st cell into the 2nd and the 5th cells
[->+>>>+<<<<] # |0|a|0|0|a|0|


# input the 2nd number into the 1st cell
, # |b|a|0|0|a|0|

# copy 1st cell into the 3nd and the 6th cells
[->>+>>>+<<<<<] # |0|a|b|0|a|b|

> # move to the 2nd cell



# == Main loop ==

# decrement both 2nd and 3rd cells by 1,
# the final position depends on which number is bigger
[[->]<<]


# == Result ==
# go to the answer
>>>>

# show the answer
.