# A=B is a coding game that has only one instruction

A=B on Steam

2022.4.10 update chapter 6
2022.4.8 update chapter 5
2022.4.4 update chapter 4
2022.4.2 update chapter 3
2022.4.1 update chapter 1, 2

# Chapter 1 A=B

instruction explanation

string1 = string2 replace string2 with string1

# 1-1 A to B

given a string contains a , b and c , replace all b with a

a = b

# 1-2 Uppercase

given a string contains a , b and c , replace them with uppercase

a = A
b = B
c = C

# 1-3 SingLeton

given a string contains a , b and c , replace all consecutive letters with single letter

aa = a
bb = b
cc = c

# 1-4 SingLeton 2

given a string contains a , b and c , delete all consecutive a

aaa = aa
aa = 

# 1-5 Sort

given a string contains a , b and c , sort them in alphabetical order

ba = ab
ca = ac
cb = bc

# 1-6 Compare

given a string contains a , b , output the most letter

ab = 
ba = 
aa = a
bb = b

# Chapter 2 Keyword

instruction explanation

string1 = (return)string2 if string1 exist, output string2

# 2-1 Hello World

given a string contains a , b and c , output helloworld

= (return)helloworld

# 2-2 AAA

given a string contains a , b and c , output true if there exist at least 3 a , otherwise output false

b = 
c = 
aaa = (return)true
= (return)false

# 2-3 Exactly Three

given a string contains a , b and c , output true if there exist exactly three letters, otherwise output false

b = a
c = a
aaaa = (return)false
aaa = (return)true
= (return)false

# 2-4 Remainder

given a string contains a , b and c , output the remainder of the string length divided by 3

b = a
c = a
aaaa = a
aaa = 0
aa = 2
a = 1

# 2-5 Odd

given a string contains a , b and c , output true if all the amounts of the letters are 0 or odd, otherwise output false

ba = ab
cb = bc
ca = ac
aaa = a
bbb = b
ccc = c
aa = (return)false
bb = (return)false
cc = (return)false
 = (return)true

# 2-6 The Only

given a string contains a , b and c , output true if only 1 letter is not consecutive, otherwise output false

aaa = aa
bbb = bb
ccc = cc
aa = '
bb = '
cc = '
a = 0
b = 0
c = 0
' = 
00 = (return)false
0 = (return)true
= (return)false

# 2-7 Ascend

given a string contains a , b and c , output true if the amount of c > b > a , otherwise output false

ca = ac
ba = ab
cb = bc
bc = -
b- = -b
a- = 
-c = (return)true
= (return)false

# 2-8 Most

given a string contains a , b and c , output the most common letter

cb = bc
ca = ac
ba = ab
ab = -
-b = b-
-c = 
bc =  
ac =  
a = (return)a
b = (return)b
c = (return)c

# 2-9 Least

given a string contains a , b and c , output the least common letter

cb = bc
ca = ac
ba = ab
ab = -
-b = b-
-c =
- = (return)c
ac = (return)b
bc = (return)a

# Chapter 3 Start and End

instruction explanation

  1. (start)string1 = string2(end)string1 = string2 if string1 is at the start / end of string, replace string1 with string2
  2. string1 = (start)string2string1 = (end)string2 find the left most string1 , delete it, and add string2 at the start / end of string

# 3-1 Remove

given a string contains a , b and c , remove all a at the start and end of the string

(start)a=
(end)a=

# 3-2 Spin

given a string contains a , b and c , move every letters before a to the end of the string

(start)b = (end)b
(start)c = (end)c

# 3-3 A to B 2

given a string contains a , b and c , replace all a with b at the start and and of the string

(start)a = (end)-
- = (start)b
(end)a = (start)+
+ = (end)b

# 3-4 Swap

given a string contains a , b and c , swap all a at the start and all b at the end of the string

(start)a = +
+a = a+
(end)b = (start)b
+ = (end)a

# 3-5 Match

given a string contains a , b and c , output true if the start and end of the string is the same letter

a+ = (return)true
b- = (return)true
c. = (return)true
(start)a = (end)+
(start)b = (end)-
(start)c = (end).
= (return)false

# 3-6 Most 2

given a string contains a , b and c , output the most common letter and delete the rest

ba = ab
ca = ac
cb = bc
bc = (start)x
xa = (start)y
ac = (start)y
ab = (start)y
x = y
yc = cc
ya = aa
yb = bb

# 3-7 Palindrome

given a string contains a , b and c , output true if the string is a palindrome, otherwise output false

a+A- = 
b+B- = 
c+C- =
(start)a = (end)+A-
(start)b = (end)+B-
(start)c = (end)+C-
-+ = (return)false
= (return)true

# Chapter 4 Once Upon A Time

instruction explanation

(once)string1 = string2 this instruction only execute one time

# 4-1 Hello 2

given a string contains a , b and c , add hello to the start of the string

(once)=(start)hello

# 4-2 Remove 2

given a string contains a , b and c , remove the first 3 a

(once)a = 
(once)a =
(once)a =

# 4-3 Cut

given a string contains a , b and c , remove the first 3 letters

(once) = ---
-a = 
-b = 
-c = 

# 4-4 Remove 3

given a string contains a , b and c , remove the last 3 a

(once) = (end)---
a- = 
b- = -b
c- = -c
- = 

# 4-5 Reverse

given a string contains a , b and c , swap the first and the last letter in the string

(once) = (start)-
-a = (end)+a
-b = (end)+b
-c = (end)+c
a+ = (start)a
b+ = (start)b
c+ = (start)c

# 4-6 Reverse 2

given a string contains a , b and c , reverse the string

(once) = (start).......
.a = (start)a
.b = (start)b
.c = (start)c
. = 

# 4-7 Cut 2

given a string contains a , b and c , remove the thrid letter

(once) = (start)-..
.a = (start)a
.b = (start)b
.c = (start)c
-a = (start)..
-b = (start).. 
-c = (start).. 

# 4-8 Clone

given a string contains a , b and c , clone the first 3 letters and add them at the end of the string

(once) = (start)...
+a = (start)a
+b = (start)b
+c = (start)c
.a = (end)+aa
.b = (end)+bb
.c = (end)+cc
(once) = (start)+++

# 4-9 A to B 3

given a string contains a , b and c , replace a with b , replace b with a

(once) = .
.a = b.
.b = a.
.c = c.
. = 

# 4-10 Half

given a string contains a , b and c , remove letters in odd position

(once) = .
..a = a.
..b = b.
..c = c.
.a = .. 
.b = .. 
.c = .. 
. =

# 4-11 Clone 2

given a string contains a , b and c , clone the string

(once) = .
A = (end)+a
B = (end)+b
C = (end)+c
.a = aA.
.b = bB.
.c = cC.
. =
+ =  

# 4-12 To B or not to B

given a string contains a , b and c , replace a with b if ant b exist, otherwise replace a with c

(once)b = b- 
(once)- = (start)-
-a = b-
-b = b-
-c = c-
- = 
a = c 

# 4-13 Center

given a string contains a , b and c , output the middle letter of the string

(once) = -
(end)-a = a
(end)-b = b
(end)-c = c
-a = (end)-
-b = (end)-
-c = (end)-
a- = (start)-
b- = (start)-
c- = (start)-

# 4-14 Center 2

given a string contains a , b and c , remove the middle letter of the string

(once) = -
(once) = (end).
-a. = 
-b. = 
-c. =
a.+ = .a
b.+ = .b
c.+ = .c
a+ = +a
b+ = +b
c+ = +c
t = (end)+
-a = ta-
-b = tb-
-c = tc-

# 4-15 Expansion

given a string contains a , b and c , repeat the i th letter i times

(once) = -
-a = a-x
-b = b-x
-c = c-x
+a- = aa-x
+b- = bb-x
+c- = cc-x
+a = a+
+b = b+
+c = c+
-x = +-
+ =
- =

# 4-16 Merge

given 2 string contains a and b , merge 2 strings

(once) = |
|, = 
- = (end)y
ay = (start)a
by = (start)b
ax = (start)a
bx = (start)b
, = x,-

# Chapter 5 Math

# 5-1 Count

given a binary number, output that many a

(once) = (end)+
(start)0 = 
(start)+ = 
0- = -1
1- = 0
+ = -+a

# 5-2 A+1

given a binary number, output it +1

(once) = (end)+
(start)+ = 1
0+ = 1
1+ = +0

# 5-3 A+B

given 2 binary number, output their sum

+1 = -x+
+0 = -+
x- = -xx
- = 
1x = x0
0x = 1
x = 1
+ =

# 5-4 A-B

given 2 binary number, output their different

-1 = Tx-
-0 = T-
xT = Txx
T = 
1x = 0
0x = x1
- =
(start)0 = 

# 5-5 A*B

given 2 binary number, output their product

reference : A=B 全關卡解析 - 攻略

(once) = (start)P
< = (start)Q
Q1 = 1Q
Qx = &xQ
Q0 = 0Q
x& = &x
1& = &0
0& = 1
& = 1
(end)*1 = 
> = (end)^
1^ = 0
0^ = ^1
*0 = *
P1 = 1xP
P0 = 0P
P* = <*>
Q* = <*>
x =
Q = 
P = 

# 5-6 A/B

given 2 binary number, output their quotient and remainder

reference : A=B 全關卡解析 - 攻略

(once) = /*
/0 = /
0- = -1
1- = 0
< = (start)+
> = (end)+
* = (end)^
+//+^ = ,0
//+ = //
/+ = -/>
/^ = /<*
^ = -^+
(once) = 0
0+ = 1
1+ = +0
+ = 1

# Chapter 6 Aftermath

instruction explanation
can not use any ketword

# 6-1 Hello Again

given a string contains a , b and c , output helloworld

b = a 
c = a
aa = a
a = helloworld

# 6-2 Palindrome 2

given a string contains a , b and c , output true if the string is a palindrome, otherwise output false

參考 : A=B 全關卡解析 - 攻略

aa = ononnoa
ab = ononnob
ac = ononnoc
oa = oononno
b = oonnoonnno
c = ooonnnooonnnno
noono = onnoo
nooonno = oonnnoo
noooonnno = ooonnnnoo
ononno = true
oonnoonnno = true
ooonnnooonnnno = true
trueo = o
on = 
no = false

# 6-3 To B or not to B 2

given a string contains a , b and c , replace a with b if ant b exist, otherwise replace a with c

參考 : A=B 全關卡解析 - 攻略

%*cccccccc = b
cccccccc*@ = b
a = cccccccc*cccccccc
%c = c%
bcccccccc = b%
ccccccccb = @b
c@ = @c
* = c
cccccccc =