User:RainbowDash/RPS BF
Jump to navigation
Jump to search
Rock Paper Scissors program written in BrainFuck I finished making on 10/6/2024
Program
-[---> +<]>---.--[- --> +<]>-
.---------- --.++++++++.-[ ++> ---<] >+.[--
>+++++<]>.[----- -->++<]>+.-[++>- ----<] >.---- -------
.+++++++++++++.[--> +++++<]>+++.>-[--- >+<]>-- .-[--- --->+<]
>.++++++.++++++++++..--- -.+++.+.+[---->+<]>+++.>+[-- ->++<] >.---.
+[--->+<]>++++.+[->++<]>+.+[--- >+<]>+++.--.+++.+++++ .-.+ ++[->+ ++<]>.+
++++++++++++.>++++++++++.[->+++++++ <]>-.-[--->+<]>++.++++++.+++ [->+++< ]>.++++
+++++++++.[-->+++++<]>+++.+++++++. -[-> +++<]>.[--->+<]>+.-------.++ [->+++<]>.++++
+++++.+++.[-->+++++<]>+++.>-[--->+ <]>--- .--[--->+<]>-.------------.+ +++++++.+++[
----->++<]>.------------.+++++++. +[--->++< ]>.[++>---<]>-.-------.++[-> +++<]>.+++
++++++.+++.[-->+++++<]>+++.[-->++ +++<]>.[-- ----->++<]>+.-[++>-----<]>.- --------
--.+++++++++++++.[++>---<]>+.---- --------.++ +++[->+++<]>.+++.[-->+++++<] >+++.+
++++++.-[->+++<]>+.-[--->+<]>+.- ------.++[->+ ++<]>.+++++++++.+++.[-->++++ +<]>+++.
>-[--->+<]>--.-[------>+<]>. ++++++.++++++++ ++..----.+++.+.+[-->+<]>[-]< <<<[-]<<<<
<<<<<<<<< <<<<<[-]<< <<<<<<<[-]<<<<<<[- ]<<<<[-]<<<<<<<++++++++++..- --- --
---[+++++[>++<-]>++++<+++++>[<+>-]+++++++<[>++>+ <<-]+++++>[<+>>+<-]>[-<+>]<< [->> +>+ <<< ]>>[-<
<+>>]>>>+ ++<<[>+>->+<[>]>[<+>- ]<<[<]>-]>[-]>[- ]>>>+[--->++<]>+++.[->++++++ +<]>.++++++ .---.[-->++
+++<]>+++.>-[--->+<]>-.-[--->+ <]>++++.---.-- --.[-->+<]>+++.[-->+<]>+++.[ -]<< <<<[ -]>> +[<
<<<<,-------------------------- ----------- ---------------------------- --- --- ---- --
--- -------------------------- ------ --->+<[>-]>[-<<<<+++<<<<<+++ +>>>>>>>>> >]<<+++>+<[>
-]>[-<<<<++<<<<<++>>>>>>>>>>]< <-->+< [>-]>[-<
<<<+<<<<<+++>>>>>>>>>>]< <++++++++++++++++++++++ +++++++++++++++ +++++++
+++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++ ++++++[-]<<<[->>>+>+<<<<]>>
>>[-<<<<+>>>>]+<[>-]>[->>>>>>>++++++++ ++.++[++++>---<]>.+[--->+<]>.++++++ ++.[->+++<]>-.+++++++++++.---.
-----.-[--->+ <]>-.+[->+++<]>. +++++.------ -.--[--->+<]>-- -.+++[->+++ <]>++.++.-[---
>+<]>--.+++ [->+++<]>.++++ +++++++++.[ ++>---<]>+.---- --------.-- -[----->++<]
>.--------- ----.[--->+< ]>---.+++++ .---------.--- --------.-- [--->+<]>-
.--[->++++< ]>+.---------- .++++++.--- .[-->+++++<]>+ ++.---[->++ ++<]>.+.-
--.----.[-- >+<]>+++.[--> +<]>+++.[-] <<<<<<<<<<<<< <<<<<<<<<<< ]<<[>>>>
>[-]<<<<<-] >>>>>]<<<<<<< <->>+++++++ +++.--------- -<[->>+<<]>> [-<<+>>>
+<]<-->>>++ ++[++++>---< ]>.+[--->+< ]>+++.--.+++ .+++++.-.+++[- >+++<]>.
+++++++++++ ++.[-->+++++< ]>+++.+[->+ ++<]>.+++++.+ ++++++.++++.++++[->+ ++
<]>.+++[->+ ++<]>++.[-->+<] >+++.[-]<<< <<<<<<+>>[-]++ +++++++++++++++++++++++
+++++++++++ ++++++++++++++++ +++++++++++ ++++++++++++++++ ++++++++++++++++++++++++++
+++++++++>[-]+++++++++++++ +++++++++++++++++++++++++++ ++++++++++++++++++++++++
+++++++++++++++++++++++++ +++++++++++++++++++++++>[- ]++++++++++++++++++++++++
+++++++++++ +++++++++++++ +++++++++++++++++++ +++++++++++++++++++++
+++++++++++ +++++++++++++ +++<<<[<->+ ]<[>>[-<+>]<<[->>
+<<]>[-<+>] >[-<+>]<-]<. ++[--<++]-- [-]>[-]>[-]>[
-]>[-]>[-]> [-]<<++++++++ ++.-------- --<<<<< <+++>[-<->]
>+++<<[>+>- >+<[>]>[<+>-]< <[<]>-]>[-] >[-]>>[ -]>[-]<+<[
>-]>[->>+<] <<->+<[>-]>[->> >>>>+<<<<<] <<->+<[>- ]>[->>>>>>
>>>>+<<<<<< <<<]<<++[-]>- ->>[--[---> +<]>-.[-- -->+++++<]
>.----.--[- -->+<]>.[-]]>> >>[[--->++< ]>+++.[->+++ ++++<]>.++
++++.-[---- >+<]>+++.--[->+ +++<]>-.+[- >+++<]>+.+++ ++.-[->++++
+<]>.[-]]>>>>[+++[++++>- --<]>.+[--->+<]>+++.--.+++.+++++.-.+++[- >+++<]>.+++++++++++++.[-->+++++<]
>+++.--[->++++<]>-.+[->+ ++<]>+.+++++.+++++.+[-->+++++<]>-.[-]]+ +[--<++]--[-]<<<<<++++++++++..-
-------------[---->+<]>- -..................[-]++++++++++..----- -----<<<<<+]
Includes:
- User input
- Random number generator based off of user input
- Output telling who won, you or the computer
- Infinitely looping games
- Invalid Character Detection
- Awesome graphics!
Sample run
Rock Paper Scissors VS Computer Enter 'r' for Rock, 'p' for Paper, or 's' for Scissors Your Turn: r Computer chose: r Tie! ================== Your Turn: p Computer chose: p Tie! ================== Your Turn: s Computer chose: p You win! ================== Your Turn: h Invalid character, retype your turn: r Computer chose: r Tie! ==================
Minified program
-[--->+<]>---.--[--->+<]>-.------------.++++++++.-[++>---<]>+.[-->+++++<]>.[---- --->++<]>+.-[++>-----<]>.-----------.+++++++++++++.[-->+++++<]>+++.>-[--->+<]>-- .-[------>+<]>.++++++.++++++++++..----.+++.+.+[---->+<]>+++.>+[--->++<]>.---.+[- -->+<]>++++.+[->++<]>+.+[--->+<]>+++.--.+++.+++++.-.+++[->+++<]>.+++++++++++++.> ++++++++++.[->+++++++<]>-.-[--->+<]>++.++++++.+++[->+++<]>.+++++++++++++.[-->+++ ++<]>+++.+++++++.-[->+++<]>.[--->+<]>+.-------.++[->+++<]>.+++++++++.+++.[-->+++ ++<]>+++.>-[--->+<]>---.--[--->+<]>-.------------.++++++++.+++[----->++<]>.----- -------.+++++++.+[--->++<]>.[++>---<]>-.-------.++[->+++<]>.+++++++++.+++.[-->++ +++<]>+++.[-->+++++<]>.[------->++<]>+.-[++>-----<]>.-----------.+++++++++++++.[ ++>---<]>+.------------.+++++[->+++<]>.+++.[-->+++++<]>+++.+++++++.-[->+++<]>+.- [--->+<]>+.-------.++[->+++<]>.+++++++++.+++.[-->+++++<]>+++.>-[--->+<]>--.-[--- --->+<]>.++++++.++++++++++..----.+++.+.+[-->+<]>[-]<<<<[-]<<<<<<<<<<<<<<<<<<[-]< <<<<<<<<[-]<<<<<<[-]<<<<[-]<<<<<<<++++++++++..---------[+++++[>++<-]>++++<+++++> [<+>-]+++++++<[>++>+<<-]+++++>[<+>>+<-]>[-<+>]<<[->>+>+<<<]>>[-<<+>>]>>>+++<<[>+ >->+<[>]>[<+>-]<<[<]>-]>[-]>[-]>>>+[--->++<]>+++.[->+++++++<]>.++++++.---.[-->++ +++<]>+++.>-[--->+<]>-.-[--->+<]>++++.---.----.[-->+<]>+++.[-->+<]>+++.[-]<<<<<[ -]>>+[<<<<<,-------------------------------------------------------------------- ----------------------------------------------->+<[>-]>[-<<<<+++<<<<<++++>>>>>>> >>>]<<+++>+<[>-]>[-<<<<++<<<<<++>>>>>>>>>>]<<-->+<[>-]>[-<<<<+<<<<<+++>>>>>>>>>> ]<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++[-]<<<[->>>+>+<<<<]>>>>[-<<<<+>>>>]+<[>-]>[ ->>>>>>>++++++++++.++[++++>---<]>.+[--->+<]>.++++++++.[->+++<]>-.+++++++++++.--- .-----.-[--->+<]>-.+[->+++<]>.+++++.-------.--[--->+<]>---.+++[->+++<]>++.++.-[- -->+<]>--.+++[->+++<]>.+++++++++++++.[++>---<]>+.------------.---[----->++<]>.-- -----------.[--->+<]>---.+++++.---------.-----------.--[--->+<]>-.--[->++++<]>+. ----------.++++++.---.[-->+++++<]>+++.---[->++++<]>.+.---.----.[-->+<]>+++.[-->+ <]>+++.[-]<<<<<<<<<<<<<<<<<<<<<<<<]<<[>>>>>[-]<<<<<-]>>>>>]<<<<<<<<->>++++++++++ .----------<[->>+<<]>>[-<<+>>>+<]<-->>>++++[++++>---<]>.+[--->+<]>+++.--.+++.+++ ++.-.+++[->+++<]>.+++++++++++++.[-->+++++<]>+++.+[->+++<]>.+++++.+++++++.++++.++ ++[->+++<]>.+++[->+++<]>++.[-->+<]>+++.[-]<<<<<<<<<+>>[-]+++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++<<<[<->+]<[>>[-<+>]<<[->>+<<]>[-<+>]>[-<+>]<-]<.++[--<++]--[-]>[-]>[-]>[-] >[-]>[-]>[-]<<++++++++++.----------<<<<<<+++>[-<->]>+++<<[>+>->+<[>]>[<+>-]<<[<] >-]>[-]>[-]>>[-]>[-]<+<[>-]>[->>+<]<<->+<[>-]>[->>>>>>+<<<<<]<<->+<[>-]>[->>>>>> >>>>+<<<<<<<<<]<<++[-]>-->>[--[--->+<]>-.[---->+++++<]>.----.--[--->+<]>.[-]]>>> >[[--->++<]>+++.[->+++++++<]>.++++++.-[---->+<]>+++.--[->++++<]>-.+[->+++<]>+.++ +++.-[->+++++<]>.[-]]>>>>[+++[++++>---<]>.+[--->+<]>+++.--.+++.+++++.-.+++[->+++ <]>.+++++++++++++.[-->+++++<]>+++.--[->++++<]>-.+[->+++<]>+.+++++.+++++.+[-->+++ ++<]>-.[-]]++[--<++]--[-]<<<<<++++++++++..--------------[---->+<]>--............ ......[-]++++++++++..----------<<<<<+]