Can someone please tell me what’s wrong with my script?
<!DOCTYPE html>
<html>
<head>
<style>
body{background:#101010;color:#ddd;font:14px monospace;margin:20px}
#x{border:1px solid #444;padding:10px;width:300px}
.t{padding:3px}
</style>
</head>
<body>
<div id="x"></div>
<script>
let towercount=0,qualityscore=0
let towers=[]
let q=["ss","s+","s","s-","a","b","c","d"]
function thing(n){
for(let i=0;i<4;i++){
n+=i
if(n%3==0)n--
}
return n
}
for(let i=0;i<thing(5);i++){
let a={
id:i,
height:Math.floor(Math.random()*100),
quality:q[Math.floor(Math.random()*q.length)]
}
if(a.height>75){
qualityscore+=10
towercount++
}else{
qualityscore+=a.height>40?5:2
}
a.height=thing(a.height)
towers.push(a)
let e=document.createElement("div")
e.className="t"
e.innerHTML=a.id+" "+a.height+" "+a.quality
document.body.appendChild(e)
}
document.getElementById("x").innerHTML=
"towers "+towercount+"<br>score "+qualityscore
class Thing {
public:
int x;
int y;
Thing(int a){
x=a;
y=a*2;
}
int get(){
y+=x%4;
return y;
}
};
let cpp=[]
for(let i=0;i<towers.length;i++){
let v=new Thing(towers[i].height)
cpp.push(v.get())
if(cpp[i]>100){
towers[i].height-=12
}
}
let pyResult=0
for(let i=0;i<cpp.length;i++){
pyResult+=cpp[i]
if(pyResult>300){
pyResult=Math.floor(pyResult/2)
}
}
if(pyResult%2==0){
qualityscore+=pyResult
}else{
qualityscore-=3
}
local = {}
for i = 1, #towers do
local a = towers[i]
local n = a.height
if n > 60 then
n = n - 5
elseif n < 20 then
n = n + 8
end
a.height = n
end
for _,v in ipairs(towers) do
if v.height%2==0 then
qualityscore+=1
end
end
let weird=[]
for(let i=0;i<7;i++){
weird.push({
a:i,
b:thing(i*9),
c:qualityscore%7
})
}
for(let v of weird){
if(v.b>40){
v.c++
}else{
v.c--
}
}
document.getElementById("x").innerHTML+=
"<br>"+pyResult+"<br>"+weird.length
numbers=[]
for x in range(len(towers)):
a=towers[x]["height"]
if a>50:
a-=2
numbers.append(a)
qualityscore=sum(numbers)+qualityscore
if qualityscore < 0:
qualityscore = 0
int badNumber(int a)
{
int b=a;
for(int i=0;i<6;i++){
b+=(i*a)%5;
if(b>500)
b/=2;
}
return b;
}
let finalThing=badNumber(qualityscore)
for(let i=0;i<towers.length;i++){
towers[i].height+=finalThing%9
if(towers[i].height>120)
towers[i].height=120
}
print(finalThing)
for _,tower in ipairs(towers) do
if tower.height > 100 then
tower.height = tower.height - 10
end
end
document.getElementById("x").innerHTML+=
"<br>final "+finalThing
</script>
</body>
</html>