{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "3rxx6t7IdOgp" }, "source": [ "# Fibonacci(JavaScript)\n", "\n", "[フィボナッチ数](https://ja.wikipedia.org/wiki/%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0)\n", "\n", "1. テストファースト\n", "1. アサートファースト\n", "1. 仮実装\n", "1. 三角測量\n", "1. 明白な実装\n", "1. リファクタリン" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "cGG-ApfodUZg" }, "source": [ "## テストファースト" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 453 }, "colab_type": "code", "executionInfo": { "elapsed": 698, "status": "ok", "timestamp": 1573274466149, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "D-lIaqyWdbVu", "outputId": "c5685180-44e9-47eb-9e1a-c5fcdeeee732" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "XynJEu8LeHVl" }, "source": [ "## アサートファースト" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 453 }, "colab_type": "code", "executionInfo": { "elapsed": 727, "status": "ok", "timestamp": 1573274620504, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "z62UlBcFeQPS", "outputId": "31982e28-b994-4dfc-f2d8-cd1f5a53b468" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "ZKda7E4pecKH" }, "source": [ "## 仮実装" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 917, "status": "ok", "timestamp": 1573274734432, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "Nx2Ss7QtejKa", "outputId": "42ff2976-5a4a-4a89-bab8-5bc5cc29ea56" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "tuXbmcSVe2Fu" }, "source": [ "## 三角測量" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 453 }, "colab_type": "code", "executionInfo": { "elapsed": 695, "status": "ok", "timestamp": 1573274823062, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "fawT7yxze-Oq", "outputId": "fd3bff51-3493-4791-b163-acf8b9b787ae" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "CNoZOobYfNY_" }, "source": [ "## 明白な実装" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 697, "status": "ok", "timestamp": 1573274935907, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "Yy2bmyNKfvnb", "outputId": "8e495a41-bd1c-4428-b4ea-f27fd521f59c" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 886, "status": "ok", "timestamp": 1573275085519, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "02AXy4dvfTqz", "outputId": "7ae280ea-2385-4192-e449-5524c9eeada2" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 833, "status": "ok", "timestamp": 1573275308865, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "6sXFHbTEgN12", "outputId": "74c48585-0a9f-4752-8493-102e130f96dc" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "oAmPiJq5hIK-" }, "source": [ "## リファクタリング" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 655, "status": "ok", "timestamp": 1573275405011, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "fIKGr3zthML7", "outputId": "724d970d-a5bf-4458-db0d-b95633c3a67d" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 689, "status": "ok", "timestamp": 1573275482346, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "WST_U0fPheoc", "outputId": "567cba7e-390f-40a0-cf85-4c3ad351a7d7" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 259 }, "colab_type": "code", "executionInfo": { "elapsed": 772, "status": "ok", "timestamp": 1573276403831, "user": { "displayName": "Kakigi Katuyuki", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPb3OlX2ysmc2JV2nXUX_C3MVRAV6O3-HkTzd6=s64", "userId": "00784428381987829532" }, "user_tz": -540 }, "id": "5KeDzRhWh0zw", "outputId": "c21aafe7-f151-4850-c49e-c49b2685770c" }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " Programing Puzzles\n", " \n", " \n", "\n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "" ] } ], "metadata": { "colab": { "collapsed_sections": [ "cGG-ApfodUZg", "XynJEu8LeHVl", "ZKda7E4pecKH", "tuXbmcSVe2Fu", "CNoZOobYfNY_", "oAmPiJq5hIK-" ], "name": "FibonacciJavaScript.ipynb", "provenance": [], "toc_visible": true }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "metadata": { "collapsed": false }, "source": [] } } }, "nbformat": 4, "nbformat_minor": 1 }