GithubHelp home page GithubHelp logo

smackem / jobotwar Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 1.0 5.29 MB

A RobotWar clone using JavaFX, REST and Blazor WebAssembly

License: MIT License

Java 88.67% ANTLR 1.02% CSS 1.17% Shell 0.26% Dockerfile 0.30% PowerShell 0.15% HTML 3.87% C# 4.56%
game game-2d programming-language programming-challenges compiler antlr4 javafx blazor-webassembly javalin spa

jobotwar's People

Contributors

dependabot[bot] avatar smackem avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

schwitzkroko

jobotwar's Issues

Ensure that robot names are unique

In the EditController, make sure that robot names are unique. This is a must for the GameRecorder, which should assert on the condition.

V2 language optimizations

  • initialize variables with rhs expression if rhs is literal (LD_F64 123 for def x = 123)
  • only emit RET in state if last stmt was not RET

Nicer robot explosion

use smaller ParticleExplosion with hues 0 to 30 (or robot hue) for robot explosions

Add hypot and atan2 functions

get distance from current position to destination:
hypot(@x() - destX, @y() - destY)
this is a less verbose alternative to sqrt(dx * dx + dy * dy)
get angle to destination:
atan2(@x() - destX, @y() - destY)
this is a less verbose alternative to atan(dy / dx); // add 180 if dy < 0

Robot icons

select icon from list for robot on creation (editcontroller). display icon in robot circle.

New Language (Syntax2)

State-based language:


def aim

state main() {
    yield scan(@damage(), 0)
}

state scan(damage, radarAngle) {
    distance := @radar(radarAngle)
    if distance < 0 {
        @fire(radarAngle, abs(distance))
    }
    radarAngle = radarAngle + 7
    if @damage() != damage {
        yield newDest
    }
}

state newDest() {
    destX = @random(10, 100)
    destY = @random(10, 200)
    @speedX(destX - @x)
    @speedY(destY - @y)
    yield move(destX, destY)
}

state move(destX, destY) {
    arrivedX := false
    arrivedY := false
    if abs(destX - @x) < 30 {
        @speedX(0)
        arrivedX = true
    }
    if abs(destY - @y) < 30 {
        @speedY(0)
        arrivedY = true
    }
    if arrivedX and arrivedY {
        yield main
    }
}

function xFromAngle(angle, length) -> @x() + cos(angle) * length
function yFromAngle(angle, length) {
    return @y() + sin(angle) * length
}

Write simulation log

Log events like "robot X got killed" and robot's log messages.
Also record random numbers to enable #11.

Add documentation

  • link to original robotwars
  • new animated gif in better quality
  • language documentation for v1 and v2

Simulation Mode

add simulation mode:
as soon as the board is ready:
instead of just starting the game with the ticker, simulation calculates the outcome as quickly as possible, not restrained to ticks. if no winner can be determined, simulation ends after a few million cycles.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.