用户:Python球查看:0 回复:1 评论:0 创建时间:2023-05-20T14:41:57
会以下编程语言:
#会py
from vpython import *
def sw():
ball1 = sphere(pos=vector(0,4,0),radius=0.001,make_trail=True)
ball2 = sphere(pos=vector(0,5,0),radius=0.001,make_trail=True)
ball3 = sphere(pos=vector(0,6,0),radius=0.001,make_trail=True)
ball4 = sphere(pos=vector(0,7,0),radius=0.001,make_trail=True)
ball5 = sphere(pos=vector(0,8,0),radius=0.001,make_trail=True)
ball6 = sphere(pos=vector(0,9,0),radius=0.001,make_trail=True)
n = sphere(pos=vector(0,0,0),radius=3.5,color=color.blue)
for i in range(360):
ball1.rotate(angle=0.02,origin=vector(0,0,0))
ball2.rotate(angle=0.02,origin=vector(0,0,0))
ball3.rotate(angle=0.02,origin=vector(0,0,0))
ball4.rotate(angle=0.02,origin=vector(0,0,0))
ball5.rotate(angle=0.02,origin=vector(0,0,0))
ball6.rotate(angle=0.02,origin=vector(0,0,0))
rate(100)
sw()
//c++
#include <iostream>
#include <stdlib.h>
#include <windows.h>
using namespace std;
int main()
{
int a[20][20];
for (int i=0; i<=19; i++)
{
for (int j=0; j<=19; j++)
{
a[j][i] = rand()%5;
}
}
while (1)
{
for (int i=0; i<=19; i++)
{
for (int j=0; j<=19; j++)
{
if (a[j][i]==1)
{
cout << "■" ;
}
else
{
cout << " ";
}
}
cout << endl;
}
cout << endl;
cout << "- --- - --- - --- - --- - --- - --- - ---";
for (int i=0; i<=6; i++)
{
cout << endl;
}
Sleep(400);
for (int i=1; i<=18; i++)
{
for (int j=1; j<=18; j++)
{
int k;
k = a[j+1][i-1] + a[j+1][i] + a[j+1][i-1];
k = k + a[j][i+1] + a[j][i-1];
k = k + a[j-1][i+1] + a[j-1][i] + a[j-1][i-1];
if (k == 3 or k == rand()%8)
{
a[j][i] = 1;
}
else if (k == 4 or k == 2)
{
a[j][i] = a[j][i];
}
else
{
a[j][i] = 0;
}
}
}
}
return 0;
}
//js(不过只会搭配html\css)
function q(obj){
obj.style.background="#eee"
}
window.onload=function show(){
var con=document.getElementById("cotent")
alert(con.innerH喵L);
}
录了我吧!!!!!球球了