Python Webcrawler

import requests
from bs4 import BeautifulSoup

def crawl(url, max_depth=2):
if max_depth < 0:
return

try:
response = requests.get(url)
content = response.content
soup = BeautifulSoup(content, ‘html.parser’)

links = set()

for link in soup.find_all(‘a’):
href = link.get(‘href’)
if href and href.startswith(‘http’):
links.add(href)

print(f”Found {len(links)} links at {url}”)

for link in links:
crawl(link, max_depth – 1)

except requests.RequestException as e:
print(f”Error during requests to {url} : {str(e)}”)

# 使用例
start_url = “https://b.hatena.ne.jp/” # スタートするURL
crawl(start_url, max_depth=2) # 深さ2でクロール

C# interface

interface IPoint
{
int Px
{
get; set;
}
int Py
{
get; set;
}
}

class ReversePoint : IPoint
{
int x;
int y;

public ReversePoint(int x, int y)
{
    this.x = x;
    this.y = y;
}

public int Px
{
    get { return -x; }
    set { x = value; }
}

// Implementing Py similarly to Px
public int Py
{
    get { return -y; } // Return the negative of y
    set { y = value; } // Set y directly
}

}

class MainClass
{
public static void DisplayPoint( IPoint point)
{
Console.WriteLine(“x={0},y={1}”, point.Px, point.Py);
}

static void Main()
{
    ReversePoint p1 = new ReversePoint(-12, -300);

    Console.WriteLine(p1.Px);
    Console.WriteLine(p1.Py);

    ReversePoint p2 = new ReversePoint(12, 300);

    //プロパティの参照
    DisplayPoint(p2);
}

}

ポケモン

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

public class PlayerController : MonoBehaviour
{
public float moveSpeed;
public LayerMask solidObjectsLayer;
public LayerMask grassLayer;

private bool isMoving;
private Vector2 input;

private Animator animator;

private void Awake()
{
    animator = GetComponent<Animator>();
}
private void Update()
{
       if (!isMoving)
        {
        input.x = Input.GetAxisRaw("Horizontal");
        input.y = Input.GetAxisRaw("Vertical");

        //remove diagonal movement
        if (input.x != 0) input.y = 0;

        if(input != Vector2.zero)
        {
            animator.SetFloat("moveX", input.x);
            animator.SetFloat("moveY", input.y);
            var targetPos = transform.position;
            targetPos.x += input.x;
            targetPos.y += input.y;

            if(IsWalkable(targetPos))
            StartCoroutine(Move(targetPos));
        }
    }

    animator.SetBool("isMoving", isMoving);
}
IEnumerator Move(Vector3 targetPos)
{
    isMoving = true;

    while ((targetPos - transform.position).sqrMagnitude > Mathf.Epsilon)
    {
        transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed * Time.deltaTime);
        yield return null;
    }
    transform.position = targetPos; // 目標位置に合わせて最終位置を設定

    isMoving = false;

    CheckForEncounters();
}

private bool IsWalkable(Vector3 tagetPos)
{
    if(Physics2D.OverlapCircle(tagetPos, 0.2f, solidObjectsLayer) != null)
    {
        return false;
    }

    return true;
}

private void CheckForEncounters()
{
    if(Physics2D.OverlapCircle(transform.position, 0.2f, grassLayer) != null)
    {
        if(Random.Range(1, 101) <= 10)
        {
            Debug.Log("野生のポケモンに遭遇した");
        }
   
}

}

PlayerController.cs

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

[CreateAssetMenu(fileName = “ポケモン”, menuName = “ポケモン/新しいポケモンを作成する”)]
public class PokemonBase : ScriptableObject
{
[SerializeField] string name;

[TextArea]
[SerializeField] string description;

[SerializeField] Sprite frontSprite;
[SerializeField] Sprite backSprite;

[SerializeField] PokemonType type1;
[SerializeField] PokemonType type2;

//Base Stats
[SerializeField] int maxHp;
[SerializeField] int attack;
[SerializeField] int defense;
[SerializeField] int spAttack;
[SerializeField] int spDefense;
[SerializeField] int speed;

}

public enum PokemonType
{
None,
Normal,
Fire,
Water,
Electric,
Grass,
Ice,
Fighting,
Poison,
Ground,
Flying,
Psychic,
Bug,
Rock,
Ghost,
Dragon
}

PokemonBase

C# Talk.cs

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

public class Talk : MonoBehaviour
{
public GameObject panel;
public Text txt;
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{

}

void OnTriggerEnter(Collider col)
{
    panel.SetActive(true);
}

}

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:~ $

XR 3DCG AI生成

XR(拡張現実と仮想現実を含むエクステended Realityの略)環境で動くAIによる3DCGを作成するためには、いくつかのステップが必要です。以下に一般的な手順を示しますが、具体的なプラットフォームやツールによって異なる場合がありますので、あなたの使用する環境に合わせて適宜調整してください。

  1. アイデアの概要を決定する: 最初に、どのような種類のXRアプリケーションを作成するか、どのような3DCG要素を組み込むかを決定します。これには、ゲーム、シミュレーション、教育、エンターテインメントなど、さまざまな可能性があります。
  2. 開発プラットフォームの選択: 使用するXRプラットフォームを選択します。例えば、UnityやUnreal Engineなどが一般的な選択肢です。これらのプラットフォームは、XRアプリケーションを開発し、3DCGを扱うためのツールやエンジンを提供しています。
  3. AIモデルの準備: 使用するAIモデルを選択し、訓練済みのモデルを取得するか、独自のモデルを訓練する必要があります。このモデルは、3DCGの制御や生成、アニメーションなどに使用されます。
  4. 3DCGアセットの作成: XRアプリケーション内で表示するための3Dモデルやテクスチャなどのアセットを作成します。これは、3Dモデリングソフトウェア(Blender、Mayaなど)を使用して行います。
  5. AIとの統合: 選択したXRプラットフォームでAIモデルを統合します。これには、プログラムコードを書く必要があります。例えば、UnityではC#を使用して、AIモデルを呼び出し、3DCGアセットの動作を制御します。
  6. ユーザーインタラクションの実装: ユーザーとのインタラクションを実装します。これには、ユーザーがAIに対して操作を行ったり、3DCGオブジェクトとのやり取りを行う仕組みを作成することが含まれます。
  7. テストと調整: 作成したXRアプリケーションを実際にテストし、動作やパフォーマンスの問題を特定して修正します。ユーザーフィードバックを収集し、改善点を特定して反映させることも重要です。
  8. 展開と配布: 開発が完了したら、選択したXRプラットフォームに合わせてアプリケーションをパッケージ化し、ユーザーに配布します。これには、アプリストアへの提出などが含まれます。

上記の手順は一般的なガイドラインです。XRアプリケーションの開発は複雑で多岐にわたるため、具体的なツールやプラットフォームのドキュメントやチュートリアルを参照しながら進めることをおすすめします。また、AIと3DCGを統合する際には、適切なデータのやり取りとプログラミングスキルが必要です。