C# 列挙型

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading; // You need to include this namespace for threads

public class TestScript : MonoBehaviour
{ public enum ACTION_TYPE
{
JUMP = 0,
ATTACL = 1,
DEFENCE = 2
}

private void Start()
{
    ACTION_TYPE actionType;

    actionType = ACTION_TYPE_JUMP;

    switch(actionType)
    {
        case ACTION_TYPE_JUMP:
            break;
        case ACTION_TYPE.ATTACK:
            break;
        case ACTION_TYPE.DEFENCE:
            break;
    }
}

}

UNIX コマンド

dotinstall:~ $ ls -l
total 4
-rwxr–r– 1 dotinsta wheel 30 Sep 11 19:20 hello
dotinstall:~ $ echo $PATH
/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
dotinstall:~ $ export PATH=/home/dotinstall:$PATH
dotinstall:~ $ echo $PATH
/home/dotinstall:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
dotinstall:~ $ hello
bash: /home/dotinstall/hello: bin/ash: bad interpreter: No such file or directory
dotinstall:~ $ hallo
bash: hallo: command not found
dotinstall:~ $ cd ..
dotinstall:/home $ which hello
/home/dotinstall/hello
dotinstall:/home $ $PATH
bash: /home/dotinstall:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: No such file or directory
dotinstall:/home $ cd
dotinstall:~ $ rm hello
dotinstall:~ $

UNIX コマンド

dotinstall:~ $ ls -l /exc/shadow
ls: /exc/shadow: No such file or directory
dotinstall:~ $ ls -l /etc/shadow
-rw-r—– 1 root shadow 454 Sep 23 2020 /etc/shadow
dotinstall:~ $ cat /etc/shadow
cat: can’t open ‘/etc/shadow’: Permission denied
dotinstall:~ $ sudo !!
sudo cat /etc/shadow
root:!::0:::::
bin:!::0:::::
daemon:!::0:::::
adm:!::0:::::
lp:!::0:::::
sync:!::0:::::
shutdown:!::0:::::
halt:!::0:::::
mail:!::0:::::
news:!::0:::::
uucp:!::0:::::
operator:!::0:::::
man:!::0:::::
postmaster:!::0:::::
cron:!::0:::::
ftp:!::0:::::
sshd:!::0:::::
at:!::0:::::
squid:!::0:::::
xfs:!::0:::::
games:!::0:::::
cyrus:!::0:::::
vpopmail:!::0:::::
ntp:!::0:::::
smmsp:!::0:::::
guest:!::0:::::
nobody:!::0:::::
dotinstall:!:18528:0:99999:7:::
dotinstall:~ $ sudo

UNIX コマンド

dotinstall:~ $ ls
dotinstall:~ $ touch index.html
dotinstall:~ $ ls -l
total 0
-rw-r–r– 1 dotinsta wheel 0 Sep 8 21:06 index.html
dotinstall:~ $ rm -index.html
rm: unrecognized option: n
BusyBox v1.31.1 () multi-call binary.

Usage: rm [-irf] FILE…

Remove (unlink) FILEs

    -i      Always prompt before removing
    -f      Never prompt
    -R,-r   Recurse

dotinstall:~ $ ls
index.html
dotinstall:~ $ rm – index.html
rm: can’t remove ‘-‘: No such file or directory
dotinstall:~ $ rm – index.html
rm: can’t remove ‘-‘: No such file or directory
rm: can’t remove ‘index.html’: No such file or directory
dotinstall:~ $ ls
dotinstall:~ $

C# 変数

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class test3 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
int a;

    float b;

    string c;

    bool d;

    a = 1;
    b = 0.01f;
    c = "勇者の登場";
    d = true;

    //コンソールに表示
    Debug.Log(a);
    Debug.Log(b);
    Debug.Log(c);
    Debug.Log(d);
}

}

GPT-2を使ってマルコフ連鎖で文章生成

mari.py

from flask import Flask, render_template, request
import random
import markovify
from transformers import GPT2LMHeadModel, GPT2Tokenizer

app = Flask(name)

GPT-2モデルのロード

tokenizer = GPT2Tokenizer.from_pretrained(“gpt2”)
model = GPT2LMHeadModel.from_pretrained(“gpt2”)

マルコフ連鎖用のテキストデータを格納するリスト

text_data = []

GPT-2による自由なテキスト生成

def generate_gpt2_text(prompt, max_length=100):
input_ids = tokenizer.encode(prompt, return_tensors=”pt”)
output = model.generate(input_ids, max_length=max_length, num_return_sequences=1)
response = tokenizer.decode(output[0], skip_special_tokens=True)
return response

マルコフ連鎖モデルを生成

def build_markov_model(data):
text_model = markovify.NewlineText(data)
return text_model

マルコフ連鎖を使って新しいテキストを生成

def generate_text_with_markov(model, num_sentences=3):
generated_text = model.make_sentence()
return generated_text

ウェブアプリケーションのルート

@app.route(“/”, methods=[“GET”, “POST”])
def chatbot():
user_input = “”
gpt2_response = “”
markov_response = “”

if request.method == "POST":
    user_input = request.form["user_input"]

    # ユーザーからの入力をGPT-2に送信し、生成されたテキストを取得
    gpt2_response = generate_gpt2_text(user_input)

    # GPT-2の生成テキストをリストに追加
    text_data.append(gpt2_response)

    # マルコフ連鎖モデルを使って新しいテキストを生成
    markov_response = generate_text_with_markov(build_markov_model(text_data))

return render_template("chat.html", user_input=user_input, gpt2_response=gpt2_response, markov_response=markov_response)

if name == “main“:
app.run(debug=True)

templates

chat.html


Chatbot

Chatbot

ユーザー: 送信

ユーザーの入力:

{{ user_input }}

GPT-2生成テキスト:

{{ gpt2_response }}

マルコフ連鎖生成テキスト:

{{ markov_response }}

C# Unity Test

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class TestScript : MonoBehaviour

{

    // Start is called before the first frame update

    void Start()

    {

       string a;

       string b;

       a = “真理”;

       b = “りんご”;

       Debug.Log(a + “は” + b + “が好きです。”);

       a = “マリアンヌ”;

       b = “メロン”;

       Debug.Log(a + “は” + b + “好きです。”);

    }

    // Update is called once per frame

    void Update()

    {

        //Debug.Log(“連続表示”);

    }

}