게시판SGF 기보로 학습하는 바둑 LLM 인공지능예제 소스

예제 소스

SGF 기보로 학습하는 바둑 LLM 인공지능 · 파일 169개

services.ts

/** MariaGO 계열 게임 웹 서비스 목록 (go.mariago.kr 제외). */

export type GameService = {
  id: string;
  name: string;
  port: number;
  publicUrl: string;
  localPath?: string;
};

export const GAME_SERVICES: GameService[] = [
  {
    id: "baduk",
    name: "바둑",
    port: 3000,
    publicUrl: "https://baduk.mariago.kr/play",
    localPath: "/play",
  },
  {
    id: "stoku",
    name: "스토쿠",
    port: 3001,
    publicUrl: "https://stoku.mariago.kr/",
  },
  {
    id: "omook",
    name: "오목",
    port: 3002,
    publicUrl: "https://omook.mariago.kr/play",
    localPath: "/play",
  },
  {
    id: "othello",
    name: "오델로",
    port: 3004,
    publicUrl: "https://othello.mariago.kr/play",
    localPath: "/play",
  },
  {
    id: "tsp",
    name: "슬라이딩 퍼즐",
    port: 3005,
    publicUrl: "https://tsp.mariago.kr/",
  },
  {
    id: "viruswar",
    name: "세균전",
    port: 3006,
    publicUrl: "https://viruswar.mariago.kr/",
  },
  {
    id: "janggy",
    name: "장기",
    port: 3007,
    publicUrl: "https://janggy.mariago.kr/",
  },
  {
    id: "chess",
    name: "체스",
    port: 3008,
    publicUrl: "https://chess.mariago.kr/",
  },
  {
    id: "crossword",
    name: "십자말풀이",
    port: 3009,
    publicUrl: "https://crossword.mariago.kr/",
  },
];

function isLocalHost(hostname: string): boolean {
  return (
    hostname === "localhost" ||
    hostname === "127.0.0.1" ||
    hostname === "::1" ||
    /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)
  );
}

export function serviceHref(service: GameService, hostname?: string): string {
  const host =
    hostname ?? (typeof window !== "undefined" ? window.location.hostname : "");
  if (host && isLocalHost(host)) {
    const path = service.localPath ?? "/";
    return `http://${host}:${service.port}${path}`;
  }
  return service.publicUrl;
}