Closed6
Claude Codeを触ってみる

- とりあえずClaudeCodeを触ってみたい
- どれくらい凄いのか知りたい

インストール
Install NodeJS 18+, then run:
% npm install -g @anthropic-ai/claude-code
% claude -v
0.2.107 (Claude Code)
例の画面が来た

とりあえずテストでゲームを作ってみる
Go言語でテトリスのゲームを作ってみる
1つずつファイルが作られていく感じ。とりあえず全部Yesで進めてみる。
Goが入ってなかったけどMakefileとかも作ってくれて結構いい感じかも?
> go言語でテトリスのゲームを作成して
⏺ I'll create a Tetris game in Go for you. Let me set up the project structure and implement the game step by step.
⏺ Bash(mkdir -p src)…
⎿ (No content)
⏺ I'll implement a simple Tetris game with the following files:
- Main game file
- Tetromino definitions
- Game logic
- Rendering
Let me create these files:
⏺ Write(file_path: src/main.go)…
⎿ Wrote 45 lines to src/main.go
package main
import (
"fmt"
"time"
"github.com/nsf/termbox-go"
)
func main() {
… +35 lines (ctrl+r to expand)
⏺ Write(file_path: src/tetromino.go)…
⎿ Wrote 254 lines to src/tetromino.go
package main
// Tetromino shapes
const (
I = iota
J
L
O
S
T
… +244 lines (ctrl+r to expand)
⏺ Write(file_path: src/game.go)…
⎿ Wrote 351 lines to src/game.go
package main
import (
"math/rand"
"time"
"github.com/nsf/termbox-go"
)
const (
… +341 lines (ctrl+r to expand)
⏺ Write(file_path: go.mod)…
⎿ Wrote 7 lines to go.mod
module github.com/osamu/sample-tetris
go 1.20
require github.com/nsf/termbox-go v1.1.1
require github.com/mattn/go-runewidth v0.0.9 // indirect
⏺ Write(file_path: README.md)…
⎿ Wrote 41 lines to README.md
# Sample Tetris
A simple terminal-based Tetris game implemented in Go.
## Requirements
- Go 1.20 or later
- Terminal with color support
## Dependencies
… +31 lines (ctrl+r to expand)
⏺ Bash(cd /Users/xxxx/xxxx/xxx/ && go mod tidy)…
⎿ Error: (eval):1: command not found: go
⏺ It seems Go is not installed or not available in the current environment. Let me create a simple Makefile to help you build the project when Go is available:
⏺ Write(file_path: Makefile)…
⎿ Wrote 11 lines to Makefile
.PHONY: build run clean
build:
go mod tidy
go build -o tetris ./src
run: build
./tetris
clean:
… +1 line (ctrl+r to expand)

ちょっと挙動的に変な箇所あったけどいい感じに形になってる
ビルド時にエラーが出た内容も自動でデバックしてくれる

ちょっとだけ修正して
HardDropとかもできるようにした

ここまでで10~15分くらいでできた、凄い
でもcursorとか、github copilotとか、エディタ上で触れるAIアシスタントの方が個人的には使いやすいかなぁ。vimとか使う方であれば割とゴリゴリ使える感じではありそう。
自分はcursorでいいかも
ソースコードはこちらに↓
このスクラップは4ヶ月前にクローズされました