Skip to content

Commit

Permalink
Weekend Dev (#12)
Browse files Browse the repository at this point in the history
* Updated README.md
Added source and target compatibilities in the build.gradle
Moved WidgetEventFactory to the factory package

* Start to redoing the front end of Emoji Math
Deleted Ternary.java and old_suvenir.fxml

* Forgot the State class

* Refurbished Emoji Math

* Minor word changes in BooleanController

* Starting the move to a Finite State Machine in TwoBit

* Implemented TwoBit with a state machine

* Refurbished Extra Note
Prepare version for minor change

* Mostly finished with the AstrologyController remodel

* Finished Astrology redesign

* Minor quick fixes

* Changed the enum to just numbers

* Refurbished Blind Alley

* Finished FastMath
Updated the version number to reflect number of completed puzzles
Updated Progress.md

* Deleted remnants of old Souvenir
  • Loading branch information
Ultraviolet-Ninja authored Aug 23, 2021
1 parent f2a1a27 commit 5dddfee
Show file tree
Hide file tree
Showing 60 changed files with 1,251 additions and 1,241 deletions.
6 changes: 3 additions & 3 deletions Progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Boolean Venn Diagram
- Chord Qualities
- Emoji Math
- Fast Math
- Forget Me Not
- Hexamaze
- Laundry
Expand All @@ -15,17 +16,16 @@
- Souvenir
- TwoBit

15/100
16/100

### Incomplete Modules
- FastMath
- MicroController
- Translated Vanilla Modules (9/15 Supported languages)
- Simon States
- Shape Shift
- The Bulb

6/100
5/100

### Untouched Modules
- 3D Maze
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

[![CircleCI](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main.svg?style=shield)](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main)
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Ultraviolet-Ninja/GradleCenturion.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Ultraviolet-Ninja/GradleCenturion/context:java)
![Project Version](https://img.shields.io/badge/version-0.15.0-blueviolet)
![Project Version](https://img.shields.io/badge/version-0.16.0-blueviolet)
### Intro
This project is designed to solve all puzzles found on the Centurion Bomb from Keep Talking and Nobody Explodes, which is a combination of many community-made puzzles.<br>
This project is designed to solve all puzzles found on the Centurion Bomb from Keep Talking and Nobody Explodes, which is a combination of many community-made puzzles and some from the base game set in different languages.<br>

This is the Gradle implementation of the original project, created with the intention of using Continuous Integration to test module solutions and data structures as the project progresses. This also has helped me understand how JavaFX, Gradle and Circle CI interact with each other.
This is a huge project for one man to tackle, but it's taught me about the challenges of Java 8 with FX, CI pipelines and working in Gradle.

### Technologies
- Java 8 with FX
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ plugins {
}

group 'jasmine.jragon'
version '0.15.0'
version '0.16.0'

mainClassName = 'bomb.Main'

sourceCompatibility = 1.8
targetCompatibility = 1.8

compileJava {
options.encoding("UTF-8")
}
Expand Down
31 changes: 23 additions & 8 deletions src/main/java/bomb/Widget.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package bomb;


import bomb.enumerations.Indicator;
import bomb.enumerations.Port;
import bomb.enumerations.TrinaryState;
import bomb.enumerations.TrinarySwitch;
import bomb.modules.ab.blind_alley.BlindAlley;
import bomb.modules.dh.forget_me.ForgetMeNot;

import java.util.function.Predicate;

import static bomb.enumerations.TrinaryState.*;
import static bomb.tools.filter.Filter.*;
import static bomb.enumerations.TrinarySwitch.OFF;
import static bomb.enumerations.TrinarySwitch.ON;
import static bomb.enumerations.TrinarySwitch.UNKNOWN;
import static bomb.tools.filter.Filter.CHAR_FILTER;
import static bomb.tools.filter.Filter.NUMBER_PATTERN;
import static bomb.tools.filter.Filter.SERIAL_CODE_PATTERN;
import static bomb.tools.filter.Filter.VOWEL_FILTER;
import static bomb.tools.filter.Filter.ultimateFilter;

/**
* Widget class carries all the important widgets of the current bomb.
Expand Down Expand Up @@ -99,7 +106,7 @@ public static void setDBatteries(int dBatteries){
* @param state The state to give the Indicator
* @param which The Indicator to change
*/
public static void setIndicator(TrinaryState state, Indicator which){
public static void setIndicator(TrinarySwitch state, Indicator which){
indicatorArray[which.ordinal()].setState(state);
BlindAlley.alleyUpdate();
}
Expand Down Expand Up @@ -290,7 +297,7 @@ public static int getNumModules(){
* @param which The port to check
* @return The number of that port
*/
public static int getPort(Port which){
public static int getPortQuantity(Port which){
return portArray[which.ordinal()];
}

Expand Down Expand Up @@ -350,6 +357,14 @@ public static int getAllBatteries(){
return numDBatteries + numDoubleAs;
}

public static int getNumPlates() {
return numPlates;
}

public static String getTwoFactor() {
return twoFactor;
}

/**
* Tests to see if a specified port exists on the current bomb
*
Expand Down Expand Up @@ -386,13 +401,13 @@ private static void setAllUnknown(){
public enum IndicatorFilter {
LIT(state -> state == ON), UNLIT(state -> state == OFF), ALL(state -> state != UNKNOWN);

private final Predicate<TrinaryState> condition;
private final Predicate<TrinarySwitch> condition;

IndicatorFilter(Predicate<TrinaryState> condition){
IndicatorFilter(Predicate<TrinarySwitch> condition){
this.condition = condition;
}

public boolean test(TrinaryState state){
public boolean test(TrinarySwitch state){
return condition.test(state);
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/bomb/WidgetController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import bomb.enumerations.Indicator;
import bomb.enumerations.Port;
import bomb.enumerations.TrinaryState;
import bomb.enumerations.TrinarySwitch;
import bomb.tools.pattern.factory.TextFormatterFactory;
import bomb.tools.pattern.facade.FacadeFX;
import bomb.tools.filter.Filter;
import bomb.tools.pattern.factory.WidgetEventFactory;
import bomb.tools.pattern.observer.ObserverHub;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXTextArea;
Expand All @@ -20,7 +21,7 @@
import java.util.function.Consumer;

import static bomb.enumerations.Port.*;
import static bomb.enumerations.TrinaryState.*;
import static bomb.enumerations.TrinarySwitch.*;
import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.*;

public class WidgetController {
Expand Down Expand Up @@ -146,11 +147,11 @@ private void trnGroup(){
}

private void indicatorAction(Indicator indicator, ToggleGroup group){
TrinaryState state = determineState(group.getSelectedToggle());
TrinarySwitch state = determineState(group.getSelectedToggle());
Widget.setIndicator(state, indicator);
}

private TrinaryState determineState(Toggle selected){
private TrinarySwitch determineState(Toggle selected){
if (selected == null) return UNKNOWN;
return ((ToggleButton)selected).getText().equals("Lit") ? ON : OFF;
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/bomb/abstractions/State.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package bomb.abstractions;

public interface State<T> {
T nextState();
}
22 changes: 0 additions & 22 deletions src/main/java/bomb/abstractions/Ternary.java

This file was deleted.

21 changes: 7 additions & 14 deletions src/main/java/bomb/enumerations/Indicator.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
package bomb.enumerations;

import bomb.abstractions.Ternary;
public enum Indicator {
BOB, CAR, CLR, FRK, FRQ, IND, MSA, NSA, SIG, SND, TRN;

public enum Indicator implements Ternary {
BOB(TrinaryState.UNKNOWN), CAR(TrinaryState.UNKNOWN), CLR(TrinaryState.UNKNOWN),
FRK(TrinaryState.UNKNOWN), FRQ(TrinaryState.UNKNOWN), IND(TrinaryState.UNKNOWN),
MSA(TrinaryState.UNKNOWN), NSA(TrinaryState.UNKNOWN), SIG(TrinaryState.UNKNOWN),
SND(TrinaryState.UNKNOWN), TRN(TrinaryState.UNKNOWN);
private TrinarySwitch state;

private TrinaryState state;

@Override
public TrinaryState getState() {
public TrinarySwitch getState() {
return state;
}

@Override
public void setState(TrinaryState in){
public void setState(TrinarySwitch in){
state = in;
}

Indicator(TrinaryState in){
state = in;
Indicator(){
state = TrinarySwitch.UNKNOWN;
}
}
39 changes: 0 additions & 39 deletions src/main/java/bomb/enumerations/TrinaryState.java

This file was deleted.

21 changes: 21 additions & 0 deletions src/main/java/bomb/enumerations/TrinarySwitch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package bomb.enumerations;

/**
* TrinarySwitch deals with anything that needs to have 3 states of existence: On, Off or Unknown.
* This is most prevalent with the Indicators because we need to be able to track ones on the bomb
* that are lit and unlit.
*/
public enum TrinarySwitch {
/**
* The off state
*/
OFF,
/**
* The on state
*/
ON,
/**
* The unknown state
*/
UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This enum deals with the symbols from Astrology, each containing an index in arrays
* when used in the Astrology class
*/
public enum AstroSymbols implements Index {
public enum AstroSymbol implements Index {
/**
* The Elemental symbols
*/
Expand Down Expand Up @@ -35,7 +35,20 @@ public int getIdx() {
*
* @param index Its index number found in the bomb manual page for Astrology
*/
AstroSymbols(int index){
AstroSymbol(int index){
this.index = (byte) index;
}

public static AstroSymbol[] getElementalSymbols() {
return new AstroSymbol[]{FIRE, WATER, EARTH, AIR};
}

public static AstroSymbol[] getCelestialSymbols() {
return new AstroSymbol[]{SUN, MOON, MERCURY, VENUS, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO};
}

public static AstroSymbol[] getZodiacSymbols() {
return new AstroSymbol[]{ARIES, TAURUS, GEMINI, CANCER, LEO, VIRGO, LIBRA, SCORPIO, SAGITTARIUS, CAPRICORN,
AQUARIUS, PISCES};
}
}
Loading

0 comments on commit 5dddfee

Please sign in to comment.