Skip to content

FizzBuzz1To100 ​

1から100までを走査し、3の倍数をFizz、5の倍数をBuzz、両方の倍数をFizzBuzzとして出力します。剰余、比較、条件分岐、ループのサンプルです。

JSONファイルを開く

json
{
  "version": 1,
  "comment": "1から100までを走査し、3の倍数をFizz、5の倍数をBuzz、両方の倍数をFizzBuzzとして出力します。剰余、比較、条件分岐、ループのサンプルです。",
  "data": [
    {
      "name": "__i",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__i_next",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__remainder",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__zero",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__one",
      "type": "SystemInt32",
      "value": 1
    },
    {
      "name": "__three",
      "type": "SystemInt32",
      "value": 3
    },
    {
      "name": "__five",
      "type": "SystemInt32",
      "value": 5
    },
    {
      "name": "__fifteen",
      "type": "SystemInt32",
      "value": 15
    },
    {
      "name": "__hundred",
      "type": "SystemInt32",
      "value": 100
    },
    {
      "name": "__condition",
      "type": "SystemBoolean",
      "value": false
    },
    {
      "name": "__fizz",
      "type": "SystemString",
      "value": "Fizz"
    },
    {
      "name": "__buzz",
      "type": "SystemString",
      "value": "Buzz"
    },
    {
      "name": "__fizzbuzz",
      "type": "SystemString",
      "value": "FizzBuzz"
    },
    {
      "name": "__shiras_result_object_name",
      "type": "SystemString",
      "value": "ShirasUdonResultText"
    },
    {
      "name": "__shiras_result_object",
      "type": "UnityEngineGameObject",
      "value": null
    },
    {
      "name": "__shiras_result_text_type",
      "type": "SystemType",
      "value": "UnityEngineUIText"
    },
    {
      "name": "__shiras_result_text",
      "type": "UnityEngineUIText",
      "value": null
    },
    {
      "name": "__shiras_result_found",
      "type": "SystemBoolean",
      "value": false
    },
    {
      "name": "__shiras_result_message_0",
      "type": "SystemString",
      "value": ""
    },
    {
      "name": "__shiras_result_message_1",
      "type": "SystemString",
      "value": ""
    },
    {
      "name": "__shiras_result_message_2",
      "type": "SystemString",
      "value": ""
    },
    {
      "name": "__shiras_result_message_3",
      "type": "SystemString",
      "value": ""
    },
    {
      "name": "__shiras_result_builder",
      "type": "SystemTextStringBuilder",
      "value": null
    },
    {
      "name": "__shiras_result_builder_next",
      "type": "SystemTextStringBuilder",
      "value": null
    }
  ],
  "code": [
    {
      "name": "_start",
      "export": true,
      "instructions": [
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__ctor____SystemTextStringBuilder",
          "argumentCount": 0,
          "return": "__shiras_result_builder"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__one"
        },
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "COPY"
        },
        {
          "op": "JUMP",
          "operand": "_loop"
        }
      ]
    },
    {
      "name": "_loop",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "PUSH",
          "operand": "__hundred"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_LessThanOrEqual__SystemInt32_SystemInt32__SystemBoolean",
          "argumentCount": 2,
          "return": "__condition"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "_end"
        },
        {
          "op": "JUMP",
          "operand": "_check_fifteen"
        }
      ]
    },
    {
      "name": "_check_fifteen",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "PUSH",
          "operand": "__fifteen"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Remainder__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__remainder"
        },
        {
          "op": "PUSH",
          "operand": "__zero"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Equality__SystemInt32_SystemInt32__SystemBoolean",
          "argumentCount": 2,
          "return": "__condition"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "_check_three"
        },
        {
          "op": "PUSH",
          "operand": "__fizzbuzz"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
          "argumentCount": 1
        },
        {
          "op": "JUMP",
          "operand": "__shiras_display_0"
        }
      ]
    },
    {
      "name": "__shiras_display_0",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "PUSH",
          "operand": "__fizzbuzz"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__Append__SystemObject__SystemTextStringBuilder",
          "argumentCount": 2,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__AppendLine__SystemTextStringBuilder",
          "argumentCount": 1,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__ToString__SystemString",
          "argumentCount": 1,
          "return": "__shiras_result_message_0"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object_name"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__Find__SystemString__UnityEngineGameObject",
          "argumentCount": 1,
          "return": "__shiras_result_object"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_0"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text_type"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__GetComponent__SystemType__UnityEngineComponent",
          "argumentCount": 2,
          "return": "__shiras_result_text"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_0"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_message_0"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineUIText.__set_text__SystemString__SystemVoid",
          "argumentCount": 2
        },
        {
          "op": "JUMP",
          "operand": "__shiras_continue_0"
        }
      ]
    },
    {
      "name": "__shiras_continue_0",
      "export": false,
      "instructions": [
        {
          "op": "JUMP",
          "operand": "_increment"
        }
      ]
    },
    {
      "name": "_check_three",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "PUSH",
          "operand": "__three"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Remainder__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__remainder"
        },
        {
          "op": "PUSH",
          "operand": "__zero"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Equality__SystemInt32_SystemInt32__SystemBoolean",
          "argumentCount": 2,
          "return": "__condition"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "_check_five"
        },
        {
          "op": "PUSH",
          "operand": "__fizz"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
          "argumentCount": 1
        },
        {
          "op": "JUMP",
          "operand": "__shiras_display_1"
        }
      ]
    },
    {
      "name": "__shiras_display_1",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "PUSH",
          "operand": "__fizz"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__Append__SystemObject__SystemTextStringBuilder",
          "argumentCount": 2,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__AppendLine__SystemTextStringBuilder",
          "argumentCount": 1,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__ToString__SystemString",
          "argumentCount": 1,
          "return": "__shiras_result_message_1"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object_name"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__Find__SystemString__UnityEngineGameObject",
          "argumentCount": 1,
          "return": "__shiras_result_object"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_1"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text_type"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__GetComponent__SystemType__UnityEngineComponent",
          "argumentCount": 2,
          "return": "__shiras_result_text"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_1"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_message_1"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineUIText.__set_text__SystemString__SystemVoid",
          "argumentCount": 2
        },
        {
          "op": "JUMP",
          "operand": "__shiras_continue_1"
        }
      ]
    },
    {
      "name": "__shiras_continue_1",
      "export": false,
      "instructions": [
        {
          "op": "JUMP",
          "operand": "_increment"
        }
      ]
    },
    {
      "name": "_check_five",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "PUSH",
          "operand": "__five"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Remainder__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__remainder"
        },
        {
          "op": "PUSH",
          "operand": "__zero"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Equality__SystemInt32_SystemInt32__SystemBoolean",
          "argumentCount": 2,
          "return": "__condition"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "_print_number"
        },
        {
          "op": "PUSH",
          "operand": "__buzz"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
          "argumentCount": 1
        },
        {
          "op": "JUMP",
          "operand": "__shiras_display_2"
        }
      ]
    },
    {
      "name": "__shiras_display_2",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "PUSH",
          "operand": "__buzz"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__Append__SystemObject__SystemTextStringBuilder",
          "argumentCount": 2,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__AppendLine__SystemTextStringBuilder",
          "argumentCount": 1,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__ToString__SystemString",
          "argumentCount": 1,
          "return": "__shiras_result_message_2"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object_name"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__Find__SystemString__UnityEngineGameObject",
          "argumentCount": 1,
          "return": "__shiras_result_object"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_2"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text_type"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__GetComponent__SystemType__UnityEngineComponent",
          "argumentCount": 2,
          "return": "__shiras_result_text"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_2"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_message_2"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineUIText.__set_text__SystemString__SystemVoid",
          "argumentCount": 2
        },
        {
          "op": "JUMP",
          "operand": "__shiras_continue_2"
        }
      ]
    },
    {
      "name": "__shiras_continue_2",
      "export": false,
      "instructions": [
        {
          "op": "JUMP",
          "operand": "_increment"
        }
      ]
    },
    {
      "name": "_print_number",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
          "argumentCount": 1
        },
        {
          "op": "JUMP",
          "operand": "__shiras_display_3"
        }
      ]
    },
    {
      "name": "__shiras_display_3",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__Append__SystemObject__SystemTextStringBuilder",
          "argumentCount": 2,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__AppendLine__SystemTextStringBuilder",
          "argumentCount": 1,
          "return": "__shiras_result_builder_next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_builder"
        },
        {
          "op": "EXTERN",
          "signature": "SystemTextStringBuilder.__ToString__SystemString",
          "argumentCount": 1,
          "return": "__shiras_result_message_3"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object_name"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__Find__SystemString__UnityEngineGameObject",
          "argumentCount": 1,
          "return": "__shiras_result_object"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_3"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_object"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text_type"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineGameObject.__GetComponent__SystemType__UnityEngineComponent",
          "argumentCount": 2,
          "return": "__shiras_result_text"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineObject.__op_Implicit__UnityEngineObject__SystemBoolean",
          "argumentCount": 1,
          "return": "__shiras_result_found"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "__shiras_continue_3"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_text"
        },
        {
          "op": "PUSH",
          "operand": "__shiras_result_message_3"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineUIText.__set_text__SystemString__SystemVoid",
          "argumentCount": 2
        },
        {
          "op": "JUMP",
          "operand": "__shiras_continue_3"
        }
      ]
    },
    {
      "name": "__shiras_continue_3",
      "export": false,
      "instructions": [
        {
          "op": "JUMP",
          "operand": "_increment"
        }
      ]
    },
    {
      "name": "_increment",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "PUSH",
          "operand": "__one"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Addition__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__i_next"
        },
        {
          "op": "PUSH",
          "operand": "__i"
        },
        {
          "op": "COPY"
        },
        {
          "op": "JUMP",
          "operand": "_loop"
        }
      ]
    },
    {
      "name": "_end",
      "export": false,
      "instructions": []
    }
  ]
}